-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
93 lines (71 loc) · 3.21 KB
/
Dockerfile
File metadata and controls
93 lines (71 loc) · 3.21 KB
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
FROM ros:humble-ros-base-jammy AS base
# Install basic dev tools (And clean apt cache afterwards)
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive \
apt-get -y --quiet --no-install-recommends install \
# Download tool
curl \
# Install Zenoh ROS2 RMW
ros-"$ROS_DISTRO"-rmw-zenoh-cpp \
&& rm -rf /var/lib/apt/lists/*
# Setup Dataspeed apt
RUN curl -sSL https://bitbucket.org/DataspeedInc/ros_binaries/raw/master/dataspeed.key -o /usr/share/keyrings/dataspeed-archive-keyring.gpg \
&& sh -c 'echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/dataspeed-archive-keyring.gpg] http://packages.dataspeedinc.com/ros2/ubuntu \
$(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2-dataspeed-public.list > /dev/null'
# Setup Dataspeed rosdep
RUN sh -c "echo \"yaml http://packages.dataspeedinc.com/ros2/ros-public-\$ROS_DISTRO.yaml \$ROS_DISTRO\" \
> /etc/ros/rosdep/sources.list.d/30-dataspeed-public-\$ROS_DISTRO.list"
# Install Dataspeed Ford Drive-By-Wire ROS driver
RUN apt-get update \
&& rosdep update \
&& DEBIAN_FRONTEND=noninteractive \
apt-get -y --quiet --no-install-recommends install \
ros-"$ROS_DISTRO"-dbw-ford \
&& rm -rf /var/lib/apt/lists/*
# Setup ROS workspace folder
ENV ROS_WS=/opt/ros_ws
WORKDIR $ROS_WS
# Setup Zenoh ROS2 RMW
ENV RMW_IMPLEMENTATION=rmw_zenoh_cpp
# Enable ROS log colorised output
ENV RCUTILS_COLORIZED_OUTPUT=1
# -----------------------------------------------------------------------
FROM base AS prebuilt
# Import Five DBW code into docker image
COPY av_dbw_launch $ROS_WS/src/
# Source ROS setup for dependencies and build our code
RUN . /opt/ros/"$ROS_DISTRO"/setup.sh \
&& colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
# -----------------------------------------------------------------------
FROM base 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 \
# Dbw joystick controller
ros-"$ROS_DISTRO"-dbw-ford-joystick-demo \
# Command-line editor
nano \
# Ping network tools
inetutils-ping \
# Bash auto-completion for convenience
bash-completion \
&& rm -rf /var/lib/apt/lists/*
# Add sourcing local workspace command to bashrc when running interactively
# Add colcon build alias for convenience
RUN echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> /root/.bashrc && \
echo 'alias colcon_build="colcon build --symlink-install \
--cmake-args -DCMAKE_BUILD_TYPE=Release && \
source install/setup.bash"' >> /root/.bashrc
# Enter bash for development
CMD ["bash"]
# -----------------------------------------------------------------------
FROM base AS runtime
# Copy artifacts/binaries from prebuilt
COPY --from=prebuilt $ROS_WS/install $ROS_WS/install
# Add command to docker entrypoint to source newly compiled code in container
RUN sed --in-place --expression \
"\$isource \"$ROS_WS/install/setup.bash\" " \
/ros_entrypoint.sh
# Launch Five DBW launchfile
CMD ["ros2", "launch", "av_dbw_launch", "av_dbw.launch.xml"]