Update my_example.Dockerfile

This commit is contained in:
bjoernellens1 2023-10-23 12:17:44 +02:00 committed by GitHub
parent fe2018f00a
commit 9ae119cd7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,22 +11,15 @@ 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).
ENV UNDERLAY_WS=${UNDERLAY_WS}
ENV OVERLAY_WS=${OVERLAY_WS}
# First checks
RUN echo "Underlay WS:" && $UNDERLAY_WS
RUN echo "Overlay WS:" && $OVERLAY_WS
# Create Colcon workspace with external dependencies # Create Colcon workspace with external dependencies
RUN mkdir -p ${UNDERLAY_WS}/src RUN mkdir -p /base_ws/src
WORKDIR ${UNDERLAY_WS}/src WORKDIR /base_ws/src
COPY my.repos . COPY my.repos .
RUN mv my.repos dependencies.repos RUN mv my.repos dependencies.repos
RUN vcs import < dependencies.repos RUN vcs import < dependencies.repos
# Build the base Colcon workspace, installing dependencies first. # Build the base Colcon workspace, installing dependencies first.
WORKDIR ${UNDERLAY_WS} WORKDIR /base_ws
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 \
@ -36,7 +29,7 @@ RUN source /opt/ros/${ROS_DISTRO}/setup.bash \
RUN source /opt/ros/${ROS_DISTRO}/setup.bash \ RUN source /opt/ros/${ROS_DISTRO}/setup.bash \
&& colcon build --symlink-install && colcon build --symlink-install
#ENV UNDERLAY_WS=${UNDERLAY_WS} #ENV UNDERLAY_WS=/base_ws
# Set up the entrypoint # Set up the entrypoint
COPY ./docker/my_entrypoint.sh /entrypoint.sh COPY ./docker/my_entrypoint.sh /entrypoint.sh
@ -54,23 +47,23 @@ ENTRYPOINT [ "/entrypoint.sh" ]
FROM base AS overlay FROM base AS overlay
# Create an overlay Colcon workspace # Create an overlay Colcon workspace
RUN mkdir -p ${OVERLAY_WS}/src RUN mkdir -p /overlay_ws/src
WORKDIR ${OVERLAY_WS}/src WORKDIR /overlay_ws/src
COPY my_extended.repos ./overlay.repos COPY my_extended.repos ./overlay.repos
RUN vcs import < overlay.repos RUN vcs import < overlay.repos
WORKDIR ${OVERLAY_WS} WORKDIR /overlay_ws
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive
RUN source ${UNDERLAY_WS}/install/setup.bash \ RUN source /base_ws/install/setup.bash \
&& apt-get update \ && apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install \ && DEBIAN_FRONTEND=noninteractive apt-get install \
nano \ nano \
&& rosdep install --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} -y \ && rosdep install --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} -y \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN source ${UNDERLAY_WS}/install/setup.bash \ RUN source /base_ws/install/setup.bash \
&& colcon build --symlink-install && colcon build --symlink-install
# Set up the entrypoint # Set up the entrypoint