From 1651588733b37712a22799d8e77df936b0fb2933 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 | 20 ++++++++++++++------ moveit2/Dockerfile | 4 +++- moveit2/README.md | 8 ++++++++ moveit2/build.sh | 4 +++- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 0326408..31ee595 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -20,12 +20,18 @@ 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 + uses: actions/checkout@v4 - name: Set up buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v3 - name: Build moveit2 image - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v6 with: context: moveit2 push: false @@ -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: | @@ -43,11 +51,11 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v3 - name: Build space_nav2 image - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v6 with: context: navigation2 push: false diff --git a/moveit2/Dockerfile b/moveit2/Dockerfile index 599d4a9..f54ac1f 100644 --- a/moveit2/Dockerfile +++ b/moveit2/Dockerfile @@ -19,7 +19,9 @@ # VCS_REF - The git revision of the Space ROS source code (no default value). # VERSION - The version of Space ROS (default: "preview") -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..558c32e 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! #####"