From 1d638abce3b2ea038d9d4de16c4eae64225cab83 Mon Sep 17 00:00:00 2001 From: Lukas Zanger Date: Mon, 18 Nov 2024 18:11:02 +0100 Subject: [PATCH 1/9] Remove src folder in run stage --- docker/Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docker/Dockerfile b/docker/Dockerfile index 757c9ba..0d1ea62 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -276,6 +276,9 @@ RUN if [[ -x "$(command -v colcon)" ]]; then \ ############ run ############################################################### FROM dependencies-install AS run +# remove source folder +RUN rm -rf $WORKSPACE/src + # copy ROS install space from build stage COPY --from=build $WORKSPACE/install install RUN ldconfig From e666484a5130f039d7025b32b941a062f4109ed7 Mon Sep 17 00:00:00 2001 From: Lukas Zanger Date: Tue, 19 Nov 2024 10:27:01 +0100 Subject: [PATCH 2/9] Create new bash script install-dependencies.sh --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 0d1ea62..e7f18dc 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -86,7 +86,7 @@ RUN echo "colcon list -p --base-paths src/ --packages-select \\" >> $WORKSPACE/. $WORKSPACE/.remove-packages.sh 2> /dev/null | xargs rm -rf # create install script with list of rosdep dependencies -RUN echo "set -e" >> $WORKSPACE/.install-dependencies.sh && \ +RUN echo "set -e" > $WORKSPACE/.install-dependencies.sh && \ source /opt/ros/$ROS_DISTRO/setup.bash && \ apt-get update && \ rosdep init || true && \ From e51742f178830b1980c787e464ca427aa30d03f1 Mon Sep 17 00:00:00 2001 From: Lukas Zanger Date: Tue, 19 Nov 2024 12:27:30 +0100 Subject: [PATCH 3/9] Create new install space if install directory already exists in the scope of the base image --- docker/Dockerfile | 7 +++++++ docker/entrypoint.sh | 1 + 2 files changed, 8 insertions(+) diff --git a/docker/Dockerfile b/docker/Dockerfile index e7f18dc..327b49e 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -161,6 +161,13 @@ ENV WORKSPACE=/docker-ros/ws ENV COLCON_HOME=$WORKSPACE/.colcon WORKDIR $WORKSPACE +# create new workspace if $WORKSPACE/install exists +RUN if [[ -d $WORKSPACE/install ]]; then \ + mkdir -p /opt/ws_base_image && \ + mv $WORKSPACE/install /opt/ws_base_image/ && \ + echo "source /opt/ws_base_image/install/setup.bash" >> ~/.bashrc ; \ + fi + # setup keys and sources.list for ROS packages ARG ROS_DISTRO ENV ROS_DISTRO=${ROS_DISTRO} diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index e31252c..8a47279 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -4,6 +4,7 @@ set -e # source ROS workspace source /opt/ros/$ROS_DISTRO/setup.bash [[ -f /opt/ws_rmw_zenoh/install/setup.bash ]] && source /opt/ws_rmw_zenoh/install/setup.bash +[[ -f /opt/ws_base_image/install/setup.bash ]] && source /opt/ws_base_image/install/setup.bash [[ -f $WORKSPACE/devel/setup.bash ]] && source $WORKSPACE/devel/setup.bash [[ -f $WORKSPACE/install/setup.bash ]] && source $WORKSPACE/install/setup.bash From f0efd143dbe63a2bcc03dc229fa57950eca3e005 Mon Sep 17 00:00:00 2001 From: Lukas Zanger Date: Tue, 19 Nov 2024 13:09:29 +0100 Subject: [PATCH 4/9] Modify comment --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 327b49e..b87fe62 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -161,7 +161,7 @@ ENV WORKSPACE=/docker-ros/ws ENV COLCON_HOME=$WORKSPACE/.colcon WORKDIR $WORKSPACE -# create new workspace if $WORKSPACE/install exists +# create new install space and move to it if $WORKSPACE/install exists RUN if [[ -d $WORKSPACE/install ]]; then \ mkdir -p /opt/ws_base_image && \ mv $WORKSPACE/install /opt/ws_base_image/ && \ From 42c263ec9e491650598fd8801558b7c15de623f9 Mon Sep 17 00:00:00 2001 From: Lukas Zanger Date: Tue, 19 Nov 2024 13:30:56 +0100 Subject: [PATCH 5/9] Fix order of source commands --- docker/Dockerfile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index b87fe62..e7825c4 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -161,13 +161,6 @@ ENV WORKSPACE=/docker-ros/ws ENV COLCON_HOME=$WORKSPACE/.colcon WORKDIR $WORKSPACE -# create new install space and move to it if $WORKSPACE/install exists -RUN if [[ -d $WORKSPACE/install ]]; then \ - mkdir -p /opt/ws_base_image && \ - mv $WORKSPACE/install /opt/ws_base_image/ && \ - echo "source /opt/ws_base_image/install/setup.bash" >> ~/.bashrc ; \ - fi - # setup keys and sources.list for ROS packages ARG ROS_DISTRO ENV ROS_DISTRO=${ROS_DISTRO} @@ -223,6 +216,9 @@ RUN source /opt/ros/$ROS_DISTRO/setup.bash && \ fi \ && rm -rf /var/lib/apt/lists/* +# source ROS +RUN echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> ~/.bashrc + # install desired ROS 2 middleware ARG RMW_IMPLEMENTATION="rmw_cyclonedds_cpp" ENV RMW_IMPLEMENTATION=${RMW_IMPLEMENTATION} @@ -249,8 +245,12 @@ RUN source /opt/ros/$ROS_DISTRO/setup.bash && \ rm -rf /var/lib/apt/lists/* ; \ fi -# source ROS -RUN echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> ~/.bashrc +# create new install space and move to it if $WORKSPACE/install exists +RUN if [[ -d $WORKSPACE/install ]]; then \ + mkdir -p /opt/ws_base_image && \ + mv $WORKSPACE/install /opt/ws_base_image/ && \ + echo "source /opt/ws_base_image/install/setup.bash" >> ~/.bashrc ; \ + fi # set entrypoint ENV TINI_VERSION=v0.19.0 From ef1906153ad59c32ea754e1954c89bf56be2bd7a Mon Sep 17 00:00:00 2001 From: Lukas Zanger <113989586+lukaszanger@users.noreply.github.com> Date: Tue, 19 Nov 2024 13:33:41 +0100 Subject: [PATCH 6/9] Modify comment Co-authored-by: Lennart Reiher --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index e7825c4..86da21c 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -283,7 +283,7 @@ RUN if [[ -x "$(command -v colcon)" ]]; then \ ############ run ############################################################### FROM dependencies-install AS run -# remove source folder +# remove source code, if still existing from custom.sh modifications RUN rm -rf $WORKSPACE/src # copy ROS install space from build stage From 47862e4dca5e5171523ddbdf6b9d8c1582e5c5c8 Mon Sep 17 00:00:00 2001 From: Lukas Zanger <113989586+lukaszanger@users.noreply.github.com> Date: Tue, 19 Nov 2024 13:34:11 +0100 Subject: [PATCH 7/9] Modify comment Co-authored-by: Lennart Reiher --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 86da21c..eb1c68c 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -245,7 +245,7 @@ RUN source /opt/ros/$ROS_DISTRO/setup.bash && \ rm -rf /var/lib/apt/lists/* ; \ fi -# create new install space and move to it if $WORKSPACE/install exists +# move existing install space from base image to make room for new one RUN if [[ -d $WORKSPACE/install ]]; then \ mkdir -p /opt/ws_base_image && \ mv $WORKSPACE/install /opt/ws_base_image/ && \ From 729ea2ddb4b51460e28a4d7488f95f44ff2d720c Mon Sep 17 00:00:00 2001 From: Lukas Zanger Date: Tue, 19 Nov 2024 13:39:30 +0100 Subject: [PATCH 8/9] Add source command --- docker/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/Dockerfile b/docker/Dockerfile index eb1c68c..e0e9535 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -274,6 +274,7 @@ FROM dev AS build RUN if [[ -x "$(command -v colcon)" ]]; then \ source /opt/ros/${ROS_DISTRO}/setup.bash && \ [[ -f /opt/ws_rmw_zenoh/install/setup.bash ]] && source /opt/ws_rmw_zenoh/install/setup.bash ; \ + [[ -f /opt/ws_base_image/install/setup.bash ]] && source /opt/ws_base_image/install/setup.bash ; \ colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release ; \ elif [[ -x "$(command -v catkin)" ]]; then \ catkin config --install --extend /opt/ros/${ROS_DISTRO} && \ From fe83b78d38df65ad3343af5b3027ebd1654d1791 Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Tue, 19 Nov 2024 14:48:48 +0100 Subject: [PATCH 9/9] bump version to v1.6.2 --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 345616d..998d178 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,7 @@ jobs: docker-ros: runs-on: ubuntu-latest steps: - - uses: ika-rwth-aachen/docker-ros@v1.6.1 + - uses: ika-rwth-aachen/docker-ros@v1.6.2 with: base-image: rwthika/ros2:humble command: ros2 run my_pkg my_node @@ -124,7 +124,7 @@ jobs: ```yml include: - - remote: https://raw.githubusercontent.com/ika-rwth-aachen/docker-ros/v1.6.1/.gitlab-ci/docker-ros.yml + - remote: https://raw.githubusercontent.com/ika-rwth-aachen/docker-ros/v1.6.2/.gitlab-ci/docker-ros.yml variables: BASE_IMAGE: rwthika/ros2:humble @@ -143,7 +143,7 @@ jobs: docker-ros: runs-on: ubuntu-latest steps: - - uses: ika-rwth-aachen/docker-ros@v1.6.1 + - uses: ika-rwth-aachen/docker-ros@v1.6.2 with: base-image: rwthika/ros2:humble command: ros2 run my_pkg my_node @@ -156,7 +156,7 @@ jobs: ```yml include: - - remote: https://raw.githubusercontent.com/ika-rwth-aachen/docker-ros/v1.6.1/.gitlab-ci/docker-ros.yml + - remote: https://raw.githubusercontent.com/ika-rwth-aachen/docker-ros/v1.6.2/.gitlab-ci/docker-ros.yml variables: BASE_IMAGE: rwthika/ros2:humble @@ -176,7 +176,7 @@ jobs: docker-ros: runs-on: ubuntu-latest steps: - - uses: ika-rwth-aachen/docker-ros@v1.6.1 + - uses: ika-rwth-aachen/docker-ros@v1.6.2 with: base-image: rwthika/ros2:humble command: ros2 run my_pkg my_node @@ -190,7 +190,7 @@ jobs: ```yml include: - - remote: https://raw.githubusercontent.com/ika-rwth-aachen/docker-ros/v1.6.1/.gitlab-ci/docker-ros.yml + - remote: https://raw.githubusercontent.com/ika-rwth-aachen/docker-ros/v1.6.2/.gitlab-ci/docker-ros.yml variables: BASE_IMAGE: rwthika/ros2:humble @@ -211,7 +211,7 @@ jobs: docker-ros: runs-on: ubuntu-latest steps: - - uses: ika-rwth-aachen/docker-ros@v1.6.1 + - uses: ika-rwth-aachen/docker-ros@v1.6.2 with: base-image: rwthika/ros2:humble command: ros2 run my_pkg my_node @@ -224,7 +224,7 @@ jobs: ```yml include: - - remote: https://raw.githubusercontent.com/ika-rwth-aachen/docker-ros/v1.6.1/.gitlab-ci/docker-ros.yml + - remote: https://raw.githubusercontent.com/ika-rwth-aachen/docker-ros/v1.6.2/.gitlab-ci/docker-ros.yml variables: BASE_IMAGE: rwthika/ros2:humble @@ -248,7 +248,7 @@ jobs: platform: [amd64, arm64] runs-on: [self-hosted, "${{ matrix.platform }}"] steps: - - uses: ika-rwth-aachen/docker-ros@v1.6.1 + - uses: ika-rwth-aachen/docker-ros@v1.6.2 with: base-image: rwthika/ros2:humble command: ros2 run my_pkg my_node