Skip to content

Commit

Permalink
updates to build versions for different Ubuntu releases
Browse files Browse the repository at this point in the history
  • Loading branch information
mrwalter committed Feb 27, 2024
1 parent 2b02a43 commit 1548684
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 25 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
UBUNTU_VERSION_LATEST=22.04
UBUNTU_VERSION_PREVIOUS=20.04
29 changes: 20 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
FROM ripl/lcm:latest
# Parameters
ARG REPO_NAME="libbot2-docker"
ARG DESCRIPTION="Contains the libbot libraries and executables"
ARG MAINTAINER="Matthew Walter ([email protected])"

ARG UBUNTU_VERSION=20.04

# Base image
FROM ripl/lcm:$UBUNTU_VERSION

# arguments
ARG INSTALL_DIR=/usr/local
Expand All @@ -16,6 +24,7 @@ RUN apt update && apt install -y \
freeglut3-dev \
libgtk-3-dev \
libxmu-dev \
libjpeg8-dev \
python3-numpy \
python3-scipy \
&& rm -rf /var/lib/apt/lists/*
Expand All @@ -32,11 +41,13 @@ RUN mkdir -p /tmp/libbot2 && \
#./scripts/setup/linux/ubuntu/$UBUNTU_DISTRIB_CODENAME/install_prereqs && \
#rm -rf /var/lib/apt/lists/* && \
cd .. && \
mkdir libbot2-build && \
# build libbot2
cd libbot2-build && \
cmake -DCMAKE_INSTALL_PREFIX=$LIBBOT2_INSTALL_DIR ../libbot2-master && \
make install && \
# remove source code
cd / && \
rm -rf /tmp/libbot2
mkdir libbot2-build

# && \
# # build libbot2
# cd libbot2-build && \
# cmake -DCMAKE_INSTALL_PREFIX=$LIBBOT2_INSTALL_DIR ../libbot2-master && \
# make install && \
# # remove source code
# cd / && \
# rm -rf /tmp/libbot2
111 changes: 95 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
REGISTRY_HOST=docker.io
USERNAME=ripl
NAME=libbot2-docker
#NAME=$(shell basename $(CURDIR))
NAME=libbot2

IMAGE=$(USERNAME)/$(NAME)


# Common variables
LCM_VERSION = "1.5.0"
# Ubuntu versions are stored in the .env file
include .env

# Base environments
BASE_IMAGE_ENVIRONMENT_LATEST = ripl/lcm:${UBUNTU_VERSION_LATEST}
BASE_IMAGE_ENVIRONMENT_PREVIOUS = ripl/lcm:${UBUNTU_VERSION_PREVIOUS}


# Tag: latest
BASE_IMAGE_LATEST = "ripl/lcm:latest"
BUILD_IMAGE_LATEST = "${IMAGE}:latest"
BUILD_IMAGE_LATEST = $(IMAGE):${UBUNTU_VERSION_LATEST}
BUILD_IMAGE_PREVIOUS = $(IMAGE):${UBUNTU_VERSION_PREVIOUS}


.PHONY: pre-build docker-build build release showver \
push cleanup
push cleanup

build: pre-build docker-build ## builds a new version of the container image(s)

pre-build: ## Update the base environment images
docker pull $(BASE_IMAGE_LATEST)
docker pull $(BASE_IMAGE_ENVIRONMENT_LATEST)
docker pull $(BASE_IMAGE_ENVIRONMENT_PREVIOUS)



post-build:
Expand All @@ -32,20 +41,90 @@ post-push:

docker-build:

# Build latest
docker buildx build --platform linux/arm64/v8,linux/amd64 --tag $(BUILD_IMAGE_LATEST) -f Dockerfile .
# Build latest with multiple tags
docker buildx build --build-arg="UBUNTU_VERSION=${UBUNTU_VERSION_LATEST}" --platform linux/arm64/v8,linux/amd64 --tag $(BUILD_IMAGE_LATEST) --tag $(IMAGE):latest -f Dockerfile .

# Build previous
docker buildx build --build-arg="UBUNTU_VERSION=${UBUNTU_VERSION_PREVIOUS}" --platform linux/arm64/v8,linux/amd64 --tag $(BUILD_IMAGE_PREVIOUS) -f Dockerfile .

release: build push ## builds a new version of your container image(s), and pushes it/them to the registry

push: pre-push do-push post-push
release: build push ## builds a new version of your container image(s), and pushes it/them to the registry

do-push:

push: pre-push do-push post-push ## pushes the images to dockerhub

do-push:
# Push lateset
docker buildx build --platform linux/arm64/v8,linux/amd64 --push --tag $(BUILD_IMAGE_LATEST) -f Dockerfile .
docker buildx build --build-arg="UBUNTU_VERSION=${UBUNTU_VERSION_LATEST}" --platform linux/arm64/v8,linux/amd64 --push --tag $(BUILD_IMAGE_LATEST) --tag $(IMAGE):latest -f Dockerfile .

# Push previous
docker buildx build --build-arg="UBUNTU_VERSION=${UBUNTU_VERSION_PREVIOUS}" --platform linux/arm64/v8,linux/amd64 --push --tag $(BUILD_IMAGE_PREVIOUS) -f Dockerfile .


cleanup: ## Remove images pulled/generated as part of the build process
docker rmi $(BASE_IMAGE_LATEST)
docker rmi $(BUILD_IMAGE_LATEST)
docker rmi $(IMAGE):latest
docker rmi $(BUILD_IMAGE_PREVIOUS)
docker rmi $(BASE_IMAGE_ENVIRONMENT_LATEST)
docker rmi $(BASE_IMAGE_ENVIRONMENT_PREVIOUS)


showver: ## shows the current release tag based on the workspace
echo "RELEASE_VERSION: $(RELEASE_VERSION)"


help: ## show this help.
@fgrep -h "##" $(MAKEFILE_LIST) | grep -v fgrep | sed -e 's/\([^:]*\):[^#]*##\(.*\)/printf '"'%-20s - %s\\\\n' '\1' '\2'"'/' |bash


# REGISTRY_HOST=docker.io
# USERNAME=ripl
# NAME=libbot2-docker

# IMAGE=$(USERNAME)/$(NAME)


# # Common variables
# LCM_VERSION = "1.5.0"

# # Tag: latest
# BASE_IMAGE_LATEST = "ripl/lcm:latest"
# BUILD_IMAGE_LATEST = "${IMAGE}:latest"

# .PHONY: pre-build docker-build build release showver \
# push cleanup

# build: pre-build docker-build ## builds a new version of the container image(s)

# pre-build: ## Update the base environment images
# docker pull $(BASE_IMAGE_LATEST)


# post-build:


# pre-push:


# post-push:


# docker-build:

# # Build latest
# docker buildx build --platform linux/arm64/v8,linux/amd64 --tag $(BUILD_IMAGE_LATEST) -f Dockerfile .

# release: build push ## builds a new version of your container image(s), and pushes it/them to the registry

# push: pre-push do-push post-push

# do-push:
# # Push lateset
# docker buildx build --platform linux/arm64/v8,linux/amd64 --push --tag $(BUILD_IMAGE_LATEST) -f Dockerfile .

# cleanup: ## Remove images pulled/generated as part of the build process
# docker rmi $(BASE_IMAGE_LATEST)
# docker rmi $(BUILD_IMAGE_LATEST)

help: ## show this help.
@fgrep -h "##" $(MAKEFILE_LIST) | grep -v fgrep | sed -e 's/\([^:]*\):[^#]*##\(.*\)/printf '"'%-20s - %s\\\\n' '\1' '\2'"'/' |bash
# help: ## show this help.
# @fgrep -h "##" $(MAKEFILE_LIST) | grep -v fgrep | sed -e 's/\([^:]*\):[^#]*##\(.*\)/printf '"'%-20s - %s\\\\n' '\1' '\2'"'/' |bash

0 comments on commit 1548684

Please sign in to comment.