From 6734c143d299768db5231e629361a6b57aabd92c Mon Sep 17 00:00:00 2001 From: Christoph Froehlich Date: Wed, 24 Jan 2024 10:37:13 +0100 Subject: [PATCH] Compile generate_parameter_library on rhel8 --- .../workflows/build_and_publish_docker.yaml | 1 + Dockerfile | 27 ---------- Dockerfile.rhel8 | 51 +++++++++++++++++++ Dockerfile.rhel9 | 4 +- ros-controls.rhel8.repos | 13 +++++ ...controls.repos => ros-controls.rhel9.repos | 2 +- 6 files changed, 68 insertions(+), 30 deletions(-) delete mode 100644 Dockerfile create mode 100644 Dockerfile.rhel8 create mode 100644 ros-controls.rhel8.repos rename ros-controls.repos => ros-controls.rhel9.repos (77%) diff --git a/.github/workflows/build_and_publish_docker.yaml b/.github/workflows/build_and_publish_docker.yaml index 761147c..3949c84 100644 --- a/.github/workflows/build_and_publish_docker.yaml +++ b/.github/workflows/build_and_publish_docker.yaml @@ -26,6 +26,7 @@ jobs: - uses: docker/build-push-action@v5 with: push: true + file: Dockerfile.rhel8 tags: ghcr.io/${{ github.repository_owner }}/ros:${{ matrix.ros_distro }}-rhel build-args: | ROS_DISTRO=${{ matrix.ros_distro }} diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index f02d32f..0000000 --- a/Dockerfile +++ /dev/null @@ -1,27 +0,0 @@ -FROM almalinux:8 -ARG ROS_DISTRO=rolling - -# install ros -ADD http://packages.ros.org/ros2/rhel/ros2.repo /etc/yum.repos.d/ros2.repo -RUN dnf install \ - 'dnf-command(config-manager)' \ - epel-release \ - cmake \ - gcc-c++ \ - make \ - langpacks-en \ - git \ - -y --refresh -RUN dnf config-manager --set-enabled powertools - -ENV ROS_DISTRO=${ROS_DISTRO} -RUN dnf install -y ros-${ROS_DISTRO}-ros-base \ -python3-rosdep \ -python3-colcon-common-extensions -RUN rosdep init -RUN pip3 install vcstool colcon-mixin colcon-coveragepy-result colcon-lcov-result - -# set up sourcing of ros -COPY ./ros_entrypoint.sh / -ENTRYPOINT [ "/ros_entrypoint.sh" ] -CMD ["bash"] diff --git a/Dockerfile.rhel8 b/Dockerfile.rhel8 new file mode 100644 index 0000000..51b023e --- /dev/null +++ b/Dockerfile.rhel8 @@ -0,0 +1,51 @@ +FROM almalinux:8 +ARG ROS_DISTRO=rolling + +# install ros +ADD http://packages.ros.org/ros2/rhel/ros2.repo /etc/yum.repos.d/ros2.repo +RUN dnf install \ + 'dnf-command(config-manager)' \ + epel-release \ + cmake \ + gcc-c++ \ + make \ + langpacks-en \ + git \ + wget \ + -y --refresh +RUN dnf config-manager --set-enabled powertools + +ENV ROS_DISTRO=${ROS_DISTRO} +RUN dnf install -y ros-${ROS_DISTRO}-ros-base \ +python3-rosdep \ +python3-colcon-common-extensions +RUN rosdep init +RUN pip3 install vcstool colcon-mixin colcon-coveragepy-result colcon-lcov-result + +# setup colcon mixin and metadata +RUN colcon mixin add default \ + https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml && \ + colcon mixin update && \ + colcon metadata add default \ + https://raw.githubusercontent.com/colcon/colcon-metadata-repository/master/index.yaml && \ + colcon metadata update + +# we have to compile generate_parameter_library from source +ENV ROS2_WS /opt/ros2_ws +RUN mkdir -p $ROS2_WS/src +WORKDIR $ROS2_WS +ADD ros-controls.rhel8.repos . +RUN vcs import src < ros-controls.rhel8.repos && \ + source /opt/ros/$ROS_DISTRO/setup.bash && \ + rosdep update --rosdistro $ROS_DISTRO && \ + rosdep install -iyr --from-path src && \ + colcon build \ + --mixin release build-testing-off \ + --cmake-args --no-warn-unused-cli \ + --packages-up-to generate_parameter_library && \ + rm -rf log src build + +# set up sourcing of ros +COPY ./ros_entrypoint.sh / +ENTRYPOINT [ "/ros_entrypoint.sh" ] +CMD ["bash"] diff --git a/Dockerfile.rhel9 b/Dockerfile.rhel9 index b4ab37a..7812caf 100644 --- a/Dockerfile.rhel9 +++ b/Dockerfile.rhel9 @@ -49,8 +49,8 @@ RUN colcon mixin add default \ ENV ROS2_WS /opt/ros2_ws RUN mkdir -p $ROS2_WS/src WORKDIR $ROS2_WS -ADD ros-controls.repos . -RUN vcs import src < ros-controls.repos && \ +ADD ros-controls.rhel9.repos . +RUN vcs import src < ros-controls.rhel9.repos && \ source /opt/ros/$ROS_DISTRO/setup.sh && \ rosdep update --rosdistro $ROS_DISTRO && \ rosdep install -iyr --from-path src || true && \ diff --git a/ros-controls.rhel8.repos b/ros-controls.rhel8.repos new file mode 100644 index 0000000..d6dbb5e --- /dev/null +++ b/ros-controls.rhel8.repos @@ -0,0 +1,13 @@ +repositories: + rsl: + type: git + url: https://github.com/christophfroehlich/RSL.git + version: main + generate_parameter_library: + type: git + url: https://github.com/PickNikRobotics/generate_parameter_library.git + version: main + cpp_polyfills: + type: git + url: https://github.com/PickNikRobotics/cpp_polyfills.git + version: main \ No newline at end of file diff --git a/ros-controls.repos b/ros-controls.rhel9.repos similarity index 77% rename from ros-controls.repos rename to ros-controls.rhel9.repos index e47f561..46343e9 100644 --- a/ros-controls.repos +++ b/ros-controls.rhel9.repos @@ -1,7 +1,7 @@ repositories: rsl: type: git - url: https://github.com/PickNikRobotics/RSL.git + url: https://github.com/christophfroehlich/RSL.git version: main generate_parameter_library: type: git