-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
61 lines (54 loc) · 1.76 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
ARG FROM_IMAGE=ros:foxy
ARG OVERLAY_WS=/opt/ros/overlay_ws
# multi-stage for caching
FROM $FROM_IMAGE AS cacher
# clone overlay source from ros2 github for listener
ARG OVERLAY_WS
WORKDIR $OVERLAY_WS/src
RUN echo "\
repositories: \n\
ros2/demos: \n\
type: git \n\
url: https://github.com/ros2/demos.git \n\
version: ${ROS_DISTRO} \n\
" > ../overlay.repos && \
vcs import ./ < ../overlay.repos
COPY kinemic_ros_bridge/ kinemic_ros_bridge
# copy manifests for caching
WORKDIR /opt
RUN mkdir -p /tmp/opt && \
find ./ -name "package.xml" | \
xargs cp --parents -t /tmp/opt && \
find ./ -name "COLCON_IGNORE" | \
xargs cp --parents -t /tmp/opt || true
# multi-stage for building
FROM $FROM_IMAGE AS builder
# install overlay dependencies from demo_nodes and kinemic bridge
ARG OVERLAY_WS
WORKDIR $OVERLAY_WS
COPY --from=cacher /tmp/$OVERLAY_WS/src ./src
RUN . "/opt/ros/$ROS_DISTRO/setup.sh" && \
apt-get update && rosdep install -y \
--from-paths \
src/ros2/demos/demo_nodes_py \
src/kinemic_ros_bridge \
--ignore-src \
&& apt-get install --no-install-recommends -y python3-pip \
&& rm -rf /var/lib/apt/lists/*
# install Kinemic Gesture Service Python package
RUN python3 -m pip --no-cache-dir install -U kserviceconnect \
--extra-index-url 'https://repo.kinemic.com/repository/pypi/simple/'
# build overlay source
COPY --from=cacher $OVERLAY_WS/src ./src
ARG OVERLAY_MIXINS="release"
RUN . "/opt/ros/$ROS_DISTRO/setup.sh" && \
colcon build \
--packages-select \
demo_nodes_py \
kinemic_ros_bridge \
--mixin $OVERLAY_MIXINS
# source entrypoint setup
ENV OVERLAY_WS $OVERLAY_WS
RUN sed --in-place --expression \
'$isource "$OVERLAY_WS/install/setup.bash"' \
/ros_entrypoint.sh