-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathDockerfile.tester
80 lines (60 loc) · 3.21 KB
/
Dockerfile.tester
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
FROM ros:jazzy-perception AS base
SHELL [ "/bin/bash" , "-c" ]
WORKDIR /opt/ros/underlay
ENV ROS_HOME=/tmp
ENV RMW_IMPLEMENTATION=rmw_zenoh_cpp
# underlay stage: base + dependencies built
FROM base AS underlay
ADD ibpc_interfaces /opt/ros/underlay/src/ibpc_interfaces
RUN . /opt/ros/jazzy/setup.sh \
&& apt-get update \
&& rosdep update \
&& rosdep install --from-paths src --ignore-src --rosdistro jazzy -yir \
&& colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release \
--event-handlers=console_direct+ \
--merge-install
FROM underlay AS overlay
# TODO(Yadunund): Remove this step after next Jazzy sync.
RUN apt update \
&& sudo apt install curl -y \
&& curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2-testing/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
RUN apt-get update \
&& apt install -y ros-jazzy-rmw-zenoh-cpp \
&& rm -rf /var/lib/apt/lists/*
ADD ibpc_tester /opt/ros/overlay/src/ibpc_tester
RUN . /opt/ros/jazzy/setup.sh \
&& . /opt/ros/underlay/install/setup.sh \
&& cd /opt/ros/overlay \
# clone bop_toolkit and pin version to include changes from https://github.com/thodan/bop_toolkit/pull/176.
&& cd src/ && git clone https://github.com/thodan/bop_toolkit.git && cd bop_toolkit && git checkout 0cb4be14cbde81d9d19d6dfc8a2ae253cc42d411 && cd ../../ \
# && rosdep install --from-paths src --ignore-src --rosdistro jazzy -yir \
&& colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release \
--event-handlers=console_direct+ \
--merge-install
# result stage: base + copied install folders from the overlay + service setup.
FROM base
ARG DATASET_NAME
ARG SERVICE_PACKAGE=ibpc_tester
ARG SERVICE_EXECUTABLE_NAME=ibpc_tester
ARG SPLIT_TYPE=val
RUN apt update \
&& sudo apt install curl -y \
&& curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2-testing/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
RUN apt-get update \
&& apt install -y ros-jazzy-rmw-zenoh-cpp python3-imageio python3-png python3-pip python3-scipy \
&& rm -rf /var/lib/apt/lists/*
# TODO remove deprecated pytz usage
RUN python3 -m pip install pytz --break-system-packages
COPY --from=overlay /opt/ros/underlay/install /opt/ros/underlay/install
COPY --from=overlay /opt/ros/overlay/install /opt/ros/overlay/install
RUN sed --in-place \
--expression '$isource "/opt/ros/overlay/install/setup.bash"' \
/ros_entrypoint.sh
ENV DATASET_NAME=${DATASET_NAME}
ENV SERVICE_PACKAGE=${SERVICE_PACKAGE}
ENV SERVICE_EXECUTABLE_NAME=${SERVICE_EXECUTABLE_NAME}
ENV SPLIT_TYPE=${SPLIT_TYPE}
CMD exec /opt/ros/overlay/install/lib/${SERVICE_PACKAGE}/${SERVICE_EXECUTABLE_NAME} \
--ros-args -p dataset_name:=${DATASET_NAME} -p split_type:=${SPLIT_TYPE}