From bd6de91115d89a3d1095975090990e5bea02e7f9 Mon Sep 17 00:00:00 2001 From: Erik Holum Date: Tue, 24 Sep 2024 07:08:38 -0500 Subject: [PATCH] Parameterize base image name for the nav2 build (issue #161) --- navigation2/Dockerfile | 9 ++++++--- navigation2/README.md | 8 ++++++++ navigation2/build.sh | 4 +++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/navigation2/Dockerfile b/navigation2/Dockerfile index 1ebf90a..d14e24d 100644 --- a/navigation2/Dockerfile +++ b/navigation2/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/navigation2/README.md b/navigation2/README.md index cc5527f..ece7840 100644 --- a/navigation2/README.md +++ b/navigation2/README.md @@ -12,6 +12,14 @@ To build the docker image, run: The build process will take about 30 minutes, depending on the host computer. +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 +``` + ## Running the Navigation2 Docker Image in a Container After building the image, you can see the newly-built image by running: diff --git a/navigation2/build.sh b/navigation2/build.sh index bfebd2b..36b0a73 100755 --- a/navigation2/build.sh +++ b/navigation2/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! #####"