Skip to content

Commit

Permalink
Merge pull request #39 from ika-rwth-aachen/fix-workspace
Browse files Browse the repository at this point in the history
Fix workspace such that docker-ros-generated images can be used as base images for docker-ros
  • Loading branch information
lreiher authored Nov 19, 2024
2 parents 7b8a296 + fe83b78 commit e6f626d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ jobs:
docker-ros:
runs-on: ubuntu-latest
steps:
- uses: ika-rwth-aachen/[email protected].1
- uses: ika-rwth-aachen/[email protected].2
with:
base-image: rwthika/ros2:humble
command: ros2 run my_pkg my_node
Expand All @@ -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
Expand All @@ -143,7 +143,7 @@ jobs:
docker-ros:
runs-on: ubuntu-latest
steps:
- uses: ika-rwth-aachen/[email protected].1
- uses: ika-rwth-aachen/[email protected].2
with:
base-image: rwthika/ros2:humble
command: ros2 run my_pkg my_node
Expand All @@ -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
Expand All @@ -176,7 +176,7 @@ jobs:
docker-ros:
runs-on: ubuntu-latest
steps:
- uses: ika-rwth-aachen/[email protected].1
- uses: ika-rwth-aachen/[email protected].2
with:
base-image: rwthika/ros2:humble
command: ros2 run my_pkg my_node
Expand All @@ -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
Expand All @@ -211,7 +211,7 @@ jobs:
docker-ros:
runs-on: ubuntu-latest
steps:
- uses: ika-rwth-aachen/[email protected].1
- uses: ika-rwth-aachen/[email protected].2
with:
base-image: rwthika/ros2:humble
command: ros2 run my_pkg my_node
Expand All @@ -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
Expand All @@ -248,7 +248,7 @@ jobs:
platform: [amd64, arm64]
runs-on: [self-hosted, "${{ matrix.platform }}"]
steps:
- uses: ika-rwth-aachen/[email protected].1
- uses: ika-rwth-aachen/[email protected].2
with:
base-image: rwthika/ros2:humble
command: ros2 run my_pkg my_node
Expand Down
17 changes: 14 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 && \
Expand Down Expand Up @@ -216,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}
Expand All @@ -242,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
# 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/ && \
echo "source /opt/ws_base_image/install/setup.bash" >> ~/.bashrc ; \
fi
# set entrypoint
ENV TINI_VERSION=v0.19.0
Expand All @@ -267,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} && \
Expand All @@ -276,6 +284,9 @@ RUN if [[ -x "$(command -v colcon)" ]]; then \
############ run ###############################################################
FROM dependencies-install AS run
# remove source code, if still existing from custom.sh modifications
RUN rm -rf $WORKSPACE/src
# copy ROS install space from build stage
COPY --from=build $WORKSPACE/install install
RUN ldconfig
Expand Down
1 change: 1 addition & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit e6f626d

Please sign in to comment.