Skip to content

Commit

Permalink
update to multi-arch build
Browse files Browse the repository at this point in the history
  • Loading branch information
mrwalter committed Feb 26, 2024
1 parent e965629 commit dc0b932
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 24 deletions.
24 changes: 14 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,35 @@ ENV LIBBOT2_INSTALL_DIR $INSTALL_DIR

# update apt lists and install system libraries, then clean the apt cache
RUN apt update && apt install -y \
lsb-release \
# clean the apt cache
#lsb-release \
build-essential \
default-jdk \
doxygen \
file \
freeglut3-dev \
libgtk-3-dev \
libxmu-dev \
python3-numpy \
python3-scipy \
&& rm -rf /var/lib/apt/lists/*

RUN echo "Codename is: $(lsb_release -c -s)"
RUN ["echo", "$(lsb_release -c -s)"]

# build libbot2 from source
RUN mkdir -p /tmp/libbot2 && \
cd /tmp/libbot2 && \
# download libbot2
wget --no-check-certificate https://github.com/ripl-ttic/libbot2/archive/master.tar.gz && \
wget https://github.com/ripl-ttic/libbot2/archive/master.tar.gz && \
tar -zxvf master.tar.gz && \
cd libbot2-master && \
# install dependencies, then clean the apt cache
UBUNTU_DISTRIB_CODENAME=$(lsb_release -c -s) && \
./scripts/setup/linux/ubuntu/$UBUNTU_DISTRIB_CODENAME/install_prereqs && \
rm -rf /var/lib/apt/lists/* && \
#UBUNTU_DISTRIB_CODENAME=$(lsb_release -c -s) && \
#./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 && \
#BUILD_PREFIX=$LIBBOT2_INSTALL_DIR make -j && \
# remove source code
cd / && \
rm -rf /tmp/libbot2
20 changes: 6 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,19 @@ IMAGE=$(USERNAME)/$(NAME)


# Common variables
LCM_VERSION = "1.4.0"
LCM_VERSION = "1.5.0"

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

# Tag:
PREVIOUS_LCM_VERSION = "1.4.0"
BASE_IMAGE_PREVIOUS_LCM_VERSION = ripl/lcm:${PREVIOUS_LCM_VERSION}_focal
BUILD_IMAGE_PREVIOUS_LCM_VERSION = ${IMAGE}:${PREVIOUS_LCM_VERSION}


.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)
docker pull $(BASE_IMAGE_PREVIOUS_LCM_VERSION)


post-build:
Expand All @@ -39,21 +32,20 @@ post-push:

docker-build:

docker build -t $(BUILD_IMAGE_LATEST) -f Dockerfile ./

#docker build -t $(BUILD_IMAGE_PREVIOUS_LCM_VERSION) -f Dockerfile.previous_lcm_version ./
# 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:
docker push $(BUILD_IMAGE_LATEST)
#docker push $(BUILD_IMAGE_PREVIOUS_LCM_VERSION)
# 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)
#docker rmi $(BUILD_IMAGE_PREVIOUS_LCM_VERSION)

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 dc0b932

Please sign in to comment.