forked from intel/ros2_intel_realsense
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
86 lines (71 loc) · 2.08 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
ARG FROM_IMAGE=ros:eloquent
# multi-stage for caching
FROM $FROM_IMAGE AS cache
# clone underlay source
ENV UNDERLAY_WS /opt/underlay_ws
RUN mkdir -p $UNDERLAY_WS/src
WORKDIR $UNDERLAY_WS
COPY ./tools/underlay.repos ./
RUN vcs import src < underlay.repos
# copy overlay source
ENV OVERLAY_WS /opt/overlay_ws
RUN mkdir -p $OVERLAY_WS/src
WORKDIR $OVERLAY_WS
COPY ./ src/navigation2
# COPY ./tools/overlay.repos ./
# RUN vcs import src < overlay.repos
# copy manifests for caching
WORKDIR /opt
RUN find ./ -name "package.xml" | \
xargs cp --parents -t /tmp
# && find ./ -name "COLCON_IGNORE" | \
# xargs cp --parents -t /tmp
# multi-stage for building
FROM $FROM_IMAGE AS build
# install CI dependencies
RUN apt-get update && apt-get install -q -y \
ccache \
lcov \
&& rm -rf /var/lib/apt/lists/*
# copy underlay manifests
ENV UNDERLAY_WS /opt/underlay_ws
COPY --from=cache /tmp/underlay_ws $UNDERLAY_WS
WORKDIR $UNDERLAY_WS
# install underlay dependencies
RUN . /opt/ros/$ROS_DISTRO/setup.sh && \
apt-get update && rosdep install -q -y \
--from-paths src \
--ignore-src \
&& rm -rf /var/lib/apt/lists/*
# copy underlay source
COPY --from=cache $UNDERLAY_WS ./
# build underlay source
ARG UNDERLAY_MIXINS="release ccache"
RUN . /opt/ros/$ROS_DISTRO/setup.sh && \
colcon build \
--symlink-install \
--mixin $UNDERLAY_MIXINS
# copy overlay manifests
ENV OVERLAY_WS /opt/overlay_ws
COPY --from=cache /tmp/overlay_ws $OVERLAY_WS
WORKDIR $OVERLAY_WS
# install overlay dependencies
RUN . $UNDERLAY_WS/install/setup.sh && \
apt-get update && rosdep install -q -y \
--from-paths \
src \
$UNDERLAY_WS/src \
--ignore-src \
&& rm -rf /var/lib/apt/lists/*
# copy overlay source
COPY --from=cache $OVERLAY_WS ./
# build overlay source
ARG OVERLAY_MIXINS="release ccache"
RUN . $UNDERLAY_WS/install/setup.sh && \
colcon build \
--symlink-install \
--mixin $OVERLAY_MIXINS
# source overlay from entrypoint
RUN sed --in-place \
's|^source .*|source "$OVERLAY_WS/install/setup.bash"|' \
/ros_entrypoint.sh