forked from foxglove/ros-foxglove-bridge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.ros2
53 lines (42 loc) · 1.53 KB
/
Dockerfile.ros2
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
ARG ROS_DISTRIBUTION=humble
FROM ros:$ROS_DISTRIBUTION-ros-base
# Install clang and set as default compiler.
RUN apt-get update && apt-get install -y --no-install-recommends \
clang \
&& rm -rf /var/lib/apt/lists/*
ENV CC=clang
ENV CXX=clang++
# Set environment and working directory
ENV ROS_WS /ros2_ws
WORKDIR $ROS_WS
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
nlohmann-json3-dev \
libasio-dev \
libboost-all-dev \
libssl-dev \
libwebsocketpp-dev \
&& rm -rf /var/lib/apt/lists/*
# Add package.xml so we can install package dependencies.
COPY package.xml src/ros-foxglove-bridge/
# Install rosdep dependencies
RUN . /opt/ros/$ROS_DISTRO/setup.sh && \
apt-get update && rosdep update --include-eol-distros && rosdep install -y \
--from-paths \
src \
--ignore-src \
&& rm -rf /var/lib/apt/lists/*
# Add common files and ROS 2 source code
COPY CMakeLists.txt src/ros-foxglove-bridge/CMakeLists.txt
COPY foxglove_bridge_base src/ros-foxglove-bridge/foxglove_bridge_base
COPY ros2_foxglove_bridge src/ros-foxglove-bridge/ros2_foxglove_bridge
ARG USE_ASIO_STANDALONE=ON
# Build the ROS 2 workspace
RUN . /opt/ros/$ROS_DISTRO/setup.sh \
&& colcon build --event-handlers console_direct+ --cmake-args -DUSE_ASIO_STANDALONE=$USE_ASIO_STANDALONE
# source workspace from entrypoint
RUN sed --in-place \
's|^source .*|source "$ROS_WS/install/setup.bash"|' \
/ros_entrypoint.sh
# Run foxglove_bridge
CMD ["ros2", "run", "foxglove_bridge", "foxglove_bridge"]