-
Notifications
You must be signed in to change notification settings - Fork 25
/
Dockerfile
39 lines (29 loc) · 910 Bytes
/
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
# Use the official ROS 2 humble base image
ARG ROS_DISTRO=humble
FROM ros:${ROS_DISTRO} as deps
# Set the working directory
WORKDIR /root/ros2_ws
SHELL ["/bin/bash", "-c"]
RUN source /opt/ros/${ROS_DISTRO}/setup.bash
RUN apt-get update \
&& apt-get -y --quiet --no-install-recommends install \
gcc \
git \
python3 \
python3-pip
COPY . /root/ros2_ws/src
RUN rosdep install --from-paths src --ignore-src -r -y
WORKDIR /root/ros2_ws/src
RUN pip3 install -r requirements.txt
# Run a default command, e.g., starting a bash shell
CMD ["bash"]
WORKDIR /root/ros2_ws
FROM deps as builder
ARG CMAKE_BUILD_TYPE=Release
RUN source /opt/ros/${ROS_DISTRO}/setup.bash
RUN source /opt/ros/${ROS_DISTRO}/setup.bash && \
colcon build
# Source the ROS2 setup file
RUN echo "source /root/ros2_ws/install/setup.bash" >> ~/.bashrc
# Run a default command, e.g., starting a bash shell
CMD ["bash"]