Update my_example.Dockerfile

This commit is contained in:
bjoernellens1 2023-10-23 14:16:57 +02:00 committed by GitHub
parent fb0ca6fc2e
commit 272b51e250
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,7 @@ FROM osrf/ros:${ROS_DISTRO}-desktop as base
SHELL ["/bin/bash", "-c"] # change shell to bash because of better compatibility (standard shell would be sh otherwise). SHELL ["/bin/bash", "-c"] # change shell to bash because of better compatibility (standard shell would be sh otherwise).
# Create Colcon workspace with external dependencies # Create Colcon workspace with external dependencies
# This step sources our external repositories from the internet
RUN mkdir -p /base_ws/src RUN mkdir -p /base_ws/src
WORKDIR /base_ws/src WORKDIR /base_ws/src
COPY my.repos . COPY my.repos .
@ -20,12 +21,13 @@ RUN vcs import < dependencies.repos
# Build the base Colcon workspace, installing dependencies first. # Build the base Colcon workspace, installing dependencies first.
WORKDIR /base_ws WORKDIR /base_ws
# Wherever possible, install packages from apt instead of compiling from source. This is faster and more reliable.
RUN source /opt/ros/${ROS_DISTRO}/setup.bash \ RUN source /opt/ros/${ROS_DISTRO}/setup.bash \
&& apt-get update -y \ && apt-get update -y \
&& apt-get install -y --no-install-recommends \ && apt-get install -y --no-install-recommends \
ros-${ROS_DISTRO}-turtlesim \ ros-${ROS_DISTRO}-turtlesim \
ros-${ROS_DISTRO}-rqt \ ros-${ROS_DISTRO}-rqt \
&& rosdep install --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} -y && rosdep install --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} -y #This makes sure all dependencies are installed for our external sources.
RUN source /opt/ros/${ROS_DISTRO}/setup.bash \ RUN source /opt/ros/${ROS_DISTRO}/setup.bash \
&& colcon build --symlink-install && colcon build --symlink-install