2023-07-28 08:07:09 +00:00
ARG ROS_DISTRO = humble
ARG UNDERLAY_WS = /rmp_ws
ARG TARGETPLATFORM
# This file should work for both amd64 and arm64 builds. Because segway did not release some source code we must copy some binaries for the specific architectures.
# That is why we must use some conditional statements to copy over the correct files during build process.
# Variable TARGETPLATFORM should be auomatically created during build process by docker.
########################################
# Base Image for Bot Mini Control #
########################################
FROM ros:${ROS_DISTRO} as base
ENV ROS_DISTRO = ${ ROS_DISTRO }
2023-08-02 09:34:51 +00:00
#ENV TARGETPLATFORM=$TARGETPLATFORM
2023-07-28 08:07:09 +00:00
SHELL [ "/bin/bash" , "-c" ]
# Create Colcon workspace with external dependencies
RUN mkdir -p /rmp_ws/src
WORKDIR /rmp_ws/src
COPY dependencies.arm64.repos .
COPY dependencies.amd64.repos .
# Choose correct sources for architecture:
# Copy platform-specific files
# Use if condition to copy different files for different platforms
2023-08-02 09:34:51 +00:00
#RUN echo "TARGETPLATFORM is $TARGETPLATFORM"
RUN echo " Hardware platform is: $( uname -m) "
RUN uname -a
2023-08-22 06:34:05 +00:00
RUN echo "update base 22.08.2023"
2023-08-17 10:26:45 +00:00
2023-08-02 09:34:51 +00:00
RUN if [ " $( uname -m) " = "x86_64" ] ; then \
2023-08-09 14:33:46 +00:00
echo "Copying files for linux/amd64" ; \
mv dependencies.amd64.repos dependencies.repos; \
else \
echo "Copying files for linux/arm64" ; \
mv dependencies.arm64.repos dependencies.repos; \
fi
2023-07-28 08:07:09 +00:00
2023-08-02 09:34:51 +00:00
#RUN vcs import < dependencies.repos
RUN vcs import < dependencies.repos;
2023-07-28 08:07:09 +00:00
# Build the base Colcon workspace, installing dependencies first.
WORKDIR /rmp_ws
RUN source /opt/ros/${ ROS_DISTRO } /setup.bash \
2023-08-09 14:33:46 +00:00
&& apt-get update -y \
&& rosdep install --from-paths src --ignore-src --rosdistro ${ ROS_DISTRO } -y
2023-07-28 08:07:09 +00:00
2023-08-09 14:33:46 +00:00
RUN source /opt/ros/${ ROS_DISTRO } /setup.bash \
&& colcon build --symlink-install
# Use Cyclone DDS as middleware and install xacro
2023-07-28 08:07:09 +00:00
RUN apt-get update && apt-get install -y --no-install-recommends \
2023-08-09 14:33:46 +00:00
ros-${ ROS_DISTRO } -rmw-cyclonedds-cpp \
ros-${ ROS_DISTRO } -xacro \
&& rm -rf /var/lib/apt/lists/*
2023-07-31 09:49:07 +00:00
2023-07-28 08:07:09 +00:00
ENV RMW_IMPLEMENTATION = rmw_cyclonedds_cpp
ENV UNDERLAY_WS = ${ UNDERLAY_WS }
2023-08-18 07:57:35 +00:00
# Set up the entrypoint
COPY ./docker/entrypoint.sh /
RUN chmod +x /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]
2023-07-28 08:07:09 +00:00
###########################################
2023-08-03 14:19:35 +00:00
# Overlay Image for RMP Control #
2023-07-28 08:07:09 +00:00
###########################################
FROM base AS overlay
2023-08-09 14:33:46 +00:00
2023-07-28 08:07:09 +00:00
# Create an overlay Colcon workspace
RUN mkdir -p /overlay_ws/src
WORKDIR /overlay_ws/src
COPY overlay.repos .
RUN vcs import < overlay.repos
WORKDIR /overlay_ws
2023-08-02 09:34:51 +00:00
2023-08-22 06:34:05 +00:00
RUN echo "update overlay 22.08.2023"
2023-08-09 09:57:41 +00:00
2023-07-28 08:07:09 +00:00
RUN source /rmp_ws/install/setup.bash \
2023-08-09 14:33:46 +00:00
&& apt-get update \
&& rosdep install --from-paths src --ignore-src --rosdistro ${ ROS_DISTRO } -y \
&& rm -rf /var/lib/apt/lists/*
RUN source /rmp_ws/install/setup.bash \
&& colcon build --symlink-install
2023-07-28 08:07:09 +00:00
# Set up the entrypoint
COPY ./docker/entrypoint.sh /
RUN chmod +x /entrypoint.sh
2023-08-02 07:02:21 +00:00
ENTRYPOINT [ "/entrypoint.sh" ]
2023-08-02 13:56:21 +00:00
###########################################
# GUI Additions for Ros2 #
###########################################
FROM overlay AS guis
# Install additional GUI tools
RUN source /rmp_ws/install/setup.bash \
2023-08-09 14:33:46 +00:00
&& apt-get update \
&& apt-get install -y --no-install-recommends ros-${ ROS_DISTRO } -rviz2 \
&& rm -rf /var/lib/apt/lists/*
2023-08-02 13:56:21 +00:00
# Set up the entrypoint
ENTRYPOINT [ "/entrypoint.sh" ]
2023-08-02 11:59:10 +00:00
LABEL org.opencontainers.image.source= https://github.com/bjoernellens1/ros2_rmp