From 23adec1d56011431296c12614a7d75b387b188c7 Mon Sep 17 00:00:00 2001 From: Erik Holum Date: Thu, 19 Sep 2024 09:05:24 -0400 Subject: [PATCH] Parameterize base image name for the MoveIt2 build (issue #161) --- .github/workflows/docker-build.yml | 8 ++++++++ moveit2/Dockerfile | 9 ++++++--- moveit2/README.md | 8 ++++++++ moveit2/build.sh | 4 +++- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 0326408..1609d93 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -20,6 +20,12 @@ jobs: # free up a lot of stuff from /usr/local sudo rm -rf /usr/local df -h + - name: Login to ghcr + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Checkout uses: actions/checkout@v2 - name: Set up buildx @@ -33,6 +39,8 @@ jobs: cache-from: type=gha cache-to: type=gha,mode=max no-cache: false + build-args: | + SPACE_ROS_IMAGE=ghcr.io/space-ros/space-ros:main outputs: type=docker,dest=/tmp/moveit2.tar - name: Build space robots demo image run: | diff --git a/moveit2/Dockerfile b/moveit2/Dockerfile index 599d4a9..d5e095f 100644 --- a/moveit2/Dockerfile +++ b/moveit2/Dockerfile @@ -16,10 +16,13 @@ # # The script provides the following build arguments: # -# VCS_REF - The git revision of the Space ROS source code (no default value). -# VERSION - The version of Space ROS (default: "preview") +# VCS_REF - The git revision of the Space ROS source code (no default value). +# VERSION - The version of Space ROS (default: "preview") +# SPACE_ROS_IMAGE - The base Space ROS image to build on -FROM osrf/space-ros:latest +ARG SPACE_ROS_IMAGE=osrf/space-ros:latest + +FROM ${SPACE_ROS_IMAGE} # Define arguments used in the metadata definition ARG VCS_REF diff --git a/moveit2/README.md b/moveit2/README.md index 665d620..99093ec 100644 --- a/moveit2/README.md +++ b/moveit2/README.md @@ -11,6 +11,14 @@ To build the docker image, run: ./build.sh ``` +By default, this will build on top of the latest released version of the Space ROS base image (typically `osrf/space-ros:latest`). +If building locally, the underlying base image can be set in the [build script](./build.sh), or through the environment with: + +```bash +# Use a locally built image as the base +SPACE_ROS_IMAGE="space-ros:main" ./build.sh +``` + The build process will take about 30 minutes, depending on the host computer. ## Running the MoveIt2 Docker Image in a Container diff --git a/moveit2/build.sh b/moveit2/build.sh index 04cc00d..78af98f 100755 --- a/moveit2/build.sh +++ b/moveit2/build.sh @@ -16,7 +16,9 @@ echo "" docker build -t $ORG/$IMAGE:$TAG \ --build-arg VCS_REF="$VCS_REF" \ - --build-arg VERSION="$VERSION" . + --build-arg VERSION="$VERSION" \ + --build-arg SPACE_ROS_IMAGE="${SPACE_ROS_IMAGE:-osrf/space-ros:latest}" \ + . echo "" echo "##### Done! #####"