-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
124 lines (99 loc) · 3.81 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
FROM ros:humble-ros-base-jammy AS base
# Install key dependencies
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive \
apt-get -y --quiet --no-install-recommends install \
ros-"$ROS_DISTRO"-can-msgs \
ros-"$ROS_DISTRO"-dataspeed-ulc-msgs \
ros-"$ROS_DISTRO"-dbw-ford-msgs \
ros-"$ROS_DISTRO"-ffmpeg-image-transport \
ros-"$ROS_DISTRO"-flir-camera-msgs \
ros-"$ROS_DISTRO"-foxglove-bridge \
ros-"$ROS_DISTRO"-gps-msgs \
ros-"$ROS_DISTRO"-image-transport \
ros-"$ROS_DISTRO"-image-transport-plugins \
ros-"$ROS_DISTRO"-mcap-vendor \
ros-"$ROS_DISTRO"-microstrain-inertial-msgs \
ros-"$ROS_DISTRO"-nmea-msgs \
ros-"$ROS_DISTRO"-novatel-gps-msgs \
ros-"$ROS_DISTRO"-ouster-msgs \
ros-"$ROS_DISTRO"-radar-msgs \
ros-"$ROS_DISTRO"-rmw-cyclonedds-cpp \
ros-"$ROS_DISTRO"-rosbag2-storage-mcap \
ros-"$ROS_DISTRO"-velodyne-msgs \
ros-"$ROS_DISTRO"-geographic-msgs \
ros-"$ROS_DISTRO"-autoware-*-msgs \
python3-pip \
python3-vcstool \
&& pip install --no-cache-dir mcap colorama \
&& rm -rf /var/lib/apt/lists/*
# Setup ROS workspace folder
ENV ROS_WS=/opt/ros_ws
WORKDIR $ROS_WS
# Set cyclone DDS ROS RMW
ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
COPY ./cyclone_dds.xml $ROS_WS/
# Configure Cyclone cfg file
ENV CYCLONEDDS_URI=file://${ROS_WS}/cyclone_dds.xml
# Enable ROS log colorised output
ENV RCUTILS_COLORIZED_OUTPUT=1
# Copy tools scripts and config
COPY scripts/container_tools $ROS_WS/container_tools
COPY config $ROS_WS/config
# Set tools autocomplete
RUN echo "source $ROS_WS/container_tools/_tools_autocomplete.sh" >> /etc/bash.bashrc
# Add tools to PATH
RUN echo "export PATH=$ROS_WS/container_tools:$PATH " >> /etc/bash.bashrc &&\
# Add sourcing local workspace command to bashrc for
# convenience when running interactively
echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> /etc/bash.bashrc
# Create dep_ws
ENV DEP_WS=/opt/dep_ws
WORKDIR $DEP_WS
# Clone repos and build autoware msgs
COPY autoware_msgs.repos $DEP_WS/
RUN mkdir src && vcs import src < autoware_msgs.repos \
&& . /opt/ros/"$ROS_DISTRO"/setup.sh \
&& colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release \
&& rm -rf ./src ./build ./log \
&& echo "source $DEP_WS/install/setup.bash" >> /etc/bash.bashrc
# Come back to ros_ws
WORKDIR $ROS_WS
# Create username
ARG USER_ID
ARG GROUP_ID
ARG USERNAME=lxo
RUN groupadd -g $GROUP_ID $USERNAME && \
useradd -u $USER_ID -g $GROUP_ID -m -l $USERNAME && \
usermod -aG sudo $USERNAME && \
echo "$USERNAME ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
# -----------------------------------------------------------------------
FROM base AS prebuilt
# Nothing to build from source
# -----------------------------------------------------------------------
FROM prebuilt AS dev
# Install basic dev tools (And clean apt cache afterwards)
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive \
apt-get -y --quiet --no-install-recommends install \
# Command-line editor
nano \
# Ping network tools
inetutils-ping \
# Bash auto-completion for convenience
bash-completion \
# ROS Rqt graph \
ros-"$ROS_DISTRO"-rqt-graph \
# Plot juggler
ros-"$ROS_DISTRO"-plotjuggler-ros \
&& rm -rf /var/lib/apt/lists/*
# Add colcon build alias for convenience
RUN echo 'alias colcon_build="colcon build --symlink-install \
--cmake-args -DCMAKE_BUILD_TYPE=Release && \
source install/setup.bash"' >> /etc/bash.bashrc
# Enter bash for clvelopment
CMD ["bash"]
# -----------------------------------------------------------------------
FROM base AS runtime
# Start recording a rosbag by default
CMD ["/opt/ros_ws/container_tools/record_rosbag.sh"]