From ac3503daed81fdfbb3ca65fb48d453d072e46267 Mon Sep 17 00:00:00 2001 From: Erik Holum Date: Sun, 11 Aug 2024 13:30:09 -0400 Subject: [PATCH 1/6] Remove reference to spaceros dir in home directory (issue #161) --- space_robots/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/space_robots/README.md b/space_robots/README.md index c9bd284..44c380d 100644 --- a/space_robots/README.md +++ b/space_robots/README.md @@ -57,7 +57,7 @@ docker exec -it bash Make sure packages are sourced: ```bash -source ~/spaceros/install/setup.bash +source ${SPACEROS_DIR}/install/setup.bash ``` ```bash From 4ebae53dd3722f73325f1f89634f853db9c966ec Mon Sep 17 00:00:00 2001 From: Erik Holum Date: Sun, 11 Aug 2024 13:31:56 -0400 Subject: [PATCH 2/6] Replace ROSDISTRO with ROS_DISTRO (issue #161) --- moveit2/Dockerfile | 8 ++++---- navigation2/Dockerfile | 2 +- space_robots/Dockerfile | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/moveit2/Dockerfile b/moveit2/Dockerfile index 11ff916..e9b2692 100644 --- a/moveit2/Dockerfile +++ b/moveit2/Dockerfile @@ -91,9 +91,9 @@ RUN python3 -m pip install -U \ # Get the MoveIt2 source code WORKDIR ${HOME_DIR} -RUN sudo git clone https://github.com/moveit/moveit2.git -b ${ROSDISTRO} moveit2/src +RUN sudo git clone https://github.com/ros-planning/moveit2.git -b ${ROS_DISTRO} moveit2/src RUN cd ${MOVEIT2_DIR}/src \ - && sudo git clone https://github.com/moveit/moveit2_tutorials.git -b ${ROSDISTRO} + && sudo git clone https://github.com/ros-planning/moveit2_tutorials.git -b ${ROS_DISTRO} # Update the ownership of the source files (had to use sudo above to work around # a possible inherited 'insteadof' from the host that forces use of ssh @@ -108,7 +108,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ COPY --chown=${USERNAME}:${USERNAME} moveit2-pkgs.txt /tmp/ COPY --chown=${USERNAME}:${USERNAME} excluded-pkgs.txt /tmp/ RUN rosinstall_generator \ - --rosdistro ${ROSDISTRO} \ + --rosdistro ${ROS_DISTRO} \ --deps \ --exclude-path ${SPACEROS_DIR}/src \ --exclude $(cat /tmp/excluded-pkgs.txt) -- \ @@ -129,7 +129,7 @@ RUN sudo chown -R ${USERNAME}:${USERNAME} ${MOVEIT2_DIR} RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ --mount=type=cache,target=/var/lib/apt,sharing=locked \ /bin/bash -c 'source ${SPACEROS_DIR}/install/setup.bash' \ - && rosdep install --from-paths ../spaceros/src src --ignore-src --rosdistro ${ROSDISTRO} -r -y --skip-keys "console_bridge generate_parameter_library fastcdr fastrtps rti-connext-dds-5.3.1 urdfdom_headers rmw_connextdds ros_testing rmw_connextdds rmw_fastrtps_cpp rmw_fastrtps_dynamic_cpp composition demo_nodes_py lifecycle rosidl_typesupport_fastrtps_cpp rosidl_typesupport_fastrtps_c ikos diagnostic_aggregator diagnostic_updater joy qt_gui rqt_gui rqt_gui_py" + && rosdep install --from-paths ../spaceros/src src --ignore-src --rosdistro ${ROS_DISTRO} -r -y --skip-keys "console_bridge generate_parameter_library fastcdr fastrtps rti-connext-dds-5.3.1 urdfdom_headers rmw_connextdds ros_testing rmw_connextdds rmw_fastrtps_cpp rmw_fastrtps_dynamic_cpp composition demo_nodes_py lifecycle rosidl_typesupport_fastrtps_cpp rosidl_typesupport_fastrtps_c ikos diagnostic_aggregator diagnostic_updater joy qt_gui rqt_gui rqt_gui_py" # Apply a patch to octomap_msgs to work around a build issue COPY --chown=${USERNAME}:${USERNAME} octomap_fix.diff ./src/octomap_msgs diff --git a/navigation2/Dockerfile b/navigation2/Dockerfile index 05fa044..1ebf90a 100644 --- a/navigation2/Dockerfile +++ b/navigation2/Dockerfile @@ -62,7 +62,7 @@ RUN mkdir ${SPACEROS_DIR}/src \ # Generate repos file for nav2 dependencies, exclude packages from Space ROS src RUN rosinstall_generator \ - --rosdistro ${ROSDISTRO} \ + --rosdistro ${ROS_DISTRO} \ --deps \ --exclude-path ${SPACEROS_DIR}/src -- \ -- $(cat ${NAVIGATION2_WS}/nav2_dep_keys.txt) \ diff --git a/space_robots/Dockerfile b/space_robots/Dockerfile index 4f9077d..562b8a5 100644 --- a/space_robots/Dockerfile +++ b/space_robots/Dockerfile @@ -56,7 +56,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ # COPY --chown=${USERNAME}:${USERNAME} demo-pkgs.txt /tmp/ # COPY --chown=${USERNAME}:${USERNAME} excluded-pkgs.txt /tmp/ # RUN rosinstall_generator \ -# --rosdistro ${ROSDISTRO} \ +# --rosdistro ${ROS_DISTRO} \ # --deps \ # --exclude-path ${SPACEROS_DIR}/src \ # --exclude-path ${MOVEIT2_DIR}/src \ @@ -91,7 +91,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ sudo apt-get update -y \ && /bin/bash -c 'source "${SPACEROS_DIR}/install/setup.bash"' \ && /bin/bash -c 'source "${MOVEIT2_DIR}/install/setup.bash"' \ -&& rosdep install --from-paths src --ignore-src -r -y --rosdistro ${ROSDISTRO} +&& rosdep install --from-paths src --ignore-src -r -y --rosdistro ${ROS_DISTRO} # Build the demo RUN /bin/bash -c 'source ${SPACEROS_DIR}/install/setup.bash && source ${MOVEIT2_DIR}/install/setup.bash \ From 971876bcbceab03d650ee7409e4628b7a662a57c Mon Sep 17 00:00:00 2001 From: Erik Holum Date: Sun, 11 Aug 2024 13:34:27 -0400 Subject: [PATCH 3/6] Do not install rosdeps from non-existent src in moveit2 build (issue #161) --- moveit2/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moveit2/Dockerfile b/moveit2/Dockerfile index e9b2692..599d4a9 100644 --- a/moveit2/Dockerfile +++ b/moveit2/Dockerfile @@ -129,7 +129,7 @@ RUN sudo chown -R ${USERNAME}:${USERNAME} ${MOVEIT2_DIR} RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ --mount=type=cache,target=/var/lib/apt,sharing=locked \ /bin/bash -c 'source ${SPACEROS_DIR}/install/setup.bash' \ - && rosdep install --from-paths ../spaceros/src src --ignore-src --rosdistro ${ROS_DISTRO} -r -y --skip-keys "console_bridge generate_parameter_library fastcdr fastrtps rti-connext-dds-5.3.1 urdfdom_headers rmw_connextdds ros_testing rmw_connextdds rmw_fastrtps_cpp rmw_fastrtps_dynamic_cpp composition demo_nodes_py lifecycle rosidl_typesupport_fastrtps_cpp rosidl_typesupport_fastrtps_c ikos diagnostic_aggregator diagnostic_updater joy qt_gui rqt_gui rqt_gui_py" + && rosdep install --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} -r -y --skip-keys "console_bridge generate_parameter_library fastcdr fastrtps rti-connext-dds-5.3.1 urdfdom_headers rmw_connextdds ros_testing rmw_connextdds rmw_fastrtps_cpp rmw_fastrtps_dynamic_cpp composition demo_nodes_py lifecycle rosidl_typesupport_fastrtps_cpp rosidl_typesupport_fastrtps_c ikos diagnostic_aggregator diagnostic_updater joy qt_gui rqt_gui rqt_gui_py" # Apply a patch to octomap_msgs to work around a build issue COPY --chown=${USERNAME}:${USERNAME} octomap_fix.diff ./src/octomap_msgs From 23adec1d56011431296c12614a7d75b387b188c7 Mon Sep 17 00:00:00 2001 From: Erik Holum Date: Thu, 19 Sep 2024 09:05:24 -0400 Subject: [PATCH 4/6] 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! #####" From 7abc57b92050d8fd35f95c7ea21677de522e2e19 Mon Sep 17 00:00:00 2001 From: Erik Holum Date: Tue, 24 Sep 2024 07:08:38 -0500 Subject: [PATCH 5/6] 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! #####" From 22794082744de3cb07121359c9489c512eb9f3fa Mon Sep 17 00:00:00 2001 From: Erik Holum Date: Tue, 24 Sep 2024 08:10:38 -0500 Subject: [PATCH 6/6] Use osrf/space-ros:main image for base in CI (issue #161) --- .github/workflows/docker-build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 1609d93..c8a6d3f 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -40,7 +40,7 @@ jobs: cache-to: type=gha,mode=max no-cache: false build-args: | - SPACE_ROS_IMAGE=ghcr.io/space-ros/space-ros:main + SPACE_ROS_IMAGE=osrf/space-ros:main outputs: type=docker,dest=/tmp/moveit2.tar - name: Build space robots demo image run: | @@ -63,3 +63,5 @@ jobs: cache-from: type=gha cache-to: type=gha,mode=max no-cache: false + build-args: | + SPACE_ROS_IMAGE=osrf/space-ros:main