Skip to content

Commit c237fec

Browse files
committed
Only use combined overlay
given mix of build dependencies
1 parent 291b2fe commit c237fec

File tree

1 file changed

+3
-31
lines changed

1 file changed

+3
-31
lines changed

Dockerfile

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
ARG FROM_IMAGE=ros:foxy
2-
ARG UNDERLAY_WS=/opt/underlay_ws
32
ARG OVERLAY_WS=/opt/overlay_ws
43

54
# multi-stage for caching
65
FROM $FROM_IMAGE AS cacher
76

8-
# copy underlay source
9-
ARG UNDERLAY_WS
10-
WORKDIR $UNDERLAY_WS/src
11-
COPY ./ ./ros2-rust/ros2_rust
12-
137
# clone overlay source
148
ARG OVERLAY_WS
159
WORKDIR $OVERLAY_WS/src
1610
COPY ./ros2_rust.repos ../
1711
RUN vcs import ./ < ../ros2_rust.repos && \
1812
find ./ -name ".git" | xargs rm -rf
13+
COPY ./ ./ros2-rust/ros2_rust
1914

2015
# copy manifests for caching
2116
WORKDIR /opt
@@ -56,49 +51,26 @@ RUN set -eux; \
5651
cargo --version; \
5752
rustc --version;
5853

59-
# install underlay dependencies
60-
ARG UNDERLAY_WS
61-
WORKDIR $UNDERLAY_WS
62-
COPY --from=cacher /tmp/$UNDERLAY_WS ./
63-
RUN . /opt/ros/$ROS_DISTRO/setup.sh && \
64-
apt-get update && rosdep install -q -y \
65-
--from-paths src \
66-
--ignore-src \
67-
&& rm -rf /var/lib/apt/lists/*
68-
69-
# build underlay source
70-
COPY --from=cacher $UNDERLAY_WS ./
71-
ARG UNDERLAY_MIXINS="release ccache"
72-
ARG FAIL_ON_BUILD_FAILURE=True
73-
RUN . /opt/ros/$ROS_DISTRO/setup.sh && \
74-
colcon build \
75-
--symlink-install \
76-
--mixin $UNDERLAY_MIXINS \
77-
--event-handlers console_direct+ \
78-
|| ([ -z "$FAIL_ON_BUILD_FAILURE" ] || exit 1)
79-
8054
# install overlay dependencies
8155
ARG OVERLAY_WS
8256
WORKDIR $OVERLAY_WS
8357
COPY --from=cacher /tmp/$OVERLAY_WS ./
84-
RUN . $UNDERLAY_WS/install/setup.sh && \
58+
RUN . /opt/ros/$ROS_DISTRO/setup.sh && \
8559
apt-get update && rosdep install -q -y \
8660
--from-paths src \
87-
$UNDERLAY_WS/src \
8861
--ignore-src \
8962
&& rm -rf /var/lib/apt/lists/*
9063

9164
# build overlay source
9265
COPY --from=cacher $OVERLAY_WS ./
9366
ARG OVERLAY_MIXINS="release ccache"
94-
RUN . $UNDERLAY_WS/install/setup.sh && \
67+
RUN . /opt/ros/$ROS_DISTRO/setup.sh && \
9568
colcon build \
9669
--symlink-install \
9770
--mixin $OVERLAY_MIXINS \
9871
|| ([ -z "$FAIL_ON_BUILD_FAILURE" ] || exit 1)
9972

10073
# source overlay from entrypoint
101-
ENV UNDERLAY_WS $UNDERLAY_WS
10274
ENV OVERLAY_WS $OVERLAY_WS
10375
RUN sed --in-place \
10476
's|^source .*|source "$OVERLAY_WS/install/setup.bash"|' \

0 commit comments

Comments
 (0)