From e4dd8bf4bb1d66ec6272344cf0582d0c3f9d340e Mon Sep 17 00:00:00 2001 From: Ussama Naal <606033+Samahu@users.noreply.github.com> Date: Fri, 6 Dec 2024 09:32:39 -0800 Subject: [PATCH] Add the ability to configure ROS middleware upon build (#409) * Add the ability to configure ROS middleware upon build * Conditionally install cyclonedds if was chosen --- .github/workflows/docker-image.yml | 10 +++++++--- Dockerfile | 6 ++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 5404632b..548b9e5f 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -19,13 +19,17 @@ jobs: - humble - iron - jazzy + rmw_imp: + - rmw_fastrtps_cpp + - rmw_cyclonedds_cpp steps: - uses: actions/checkout@v4 with: submodules: true - name: Build the Docker image run: | - docker build . \ - --build-arg ROS_DISTRO=${{ matrix.ros_distro }} \ - --file Dockerfile \ + docker build . \ + --build-arg ROS_DISTRO=${{ matrix.ros_distro }} \ + --build-arg RMW_IMPLEMENTATION=${{ matrix.rmw_imp }} \ + --file Dockerfile \ --tag ouster-ros-${{ matrix.ros_distro }}:$(date +%s) diff --git a/Dockerfile b/Dockerfile index 7f13aae8..52981787 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,9 @@ ARG ROS_DISTRO=rolling +ARG RMW_IMPLEMENTATION=rmw_fastrtps_cpp FROM ros:${ROS_DISTRO}-ros-core AS build-env ENV DEBIAN_FRONTEND=noninteractive \ + RMW_IMPLEMENTATION=${RMW_IMPLEMENTATION} \ BUILD_HOME=/var/lib/build \ OUSTER_ROS_PATH=/opt/ros2_ws/src/ouster-ros @@ -20,6 +22,10 @@ RUN set -xue \ python3-bloom \ python3-colcon-common-extensions +RUN if [ "$RMW_IMPLEMENTATION" = "rmw_cyclonedds_cpp" ]; then \ + apt-get install -y ros-${ROS_DISTRO}-rmw-cyclonedds-cpp; \ + fi + # Set up non-root build user ARG BUILD_UID=1000 ARG BUILD_GID=${BUILD_UID}