Skip to content

Commit 1175550

Browse files
committed
Improve multi-stage perfomance and avoid cache-busting
Signed-off-by: Ryan Friedman <[email protected]>
1 parent f4eba30 commit 1175550

File tree

1 file changed

+25
-16
lines changed

1 file changed

+25
-16
lines changed

Dockerfile

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,36 @@
11
ARG ROS_DISTRO=rolling
22
FROM ros:${ROS_DISTRO}-ros-core
33

4-
RUN apt-get update \
5-
&& apt-get install -y \
6-
ros-dev-tools \
7-
wget
8-
94
WORKDIR /root/ros2_ws/
10-
RUN mkdir -p src
5+
6+
# Install essential dependencies
7+
RUN apt-get update && \
8+
apt-get install -y \
9+
ros-dev-tools \
10+
wget && \
11+
apt-get clean && \
12+
rm -rf /var/lib/apt/lists/*
13+
14+
# Clone dependencies
1115
COPY tools/ros2_dependencies.repos .
12-
RUN vcs import --input ros2_dependencies.repos src
16+
RUN mkdir -p src && \
17+
vcs import --input ros2_dependencies.repos src
18+
19+
# Initialize rosdep
1320
RUN rosdep init
1421

22+
# Copy source code
1523
COPY . src/grid_map
16-
RUN ls src/grid_map
1724

25+
# Install dependencies
1826
SHELL ["/bin/bash", "-c"]
19-
RUN apt-get update \
20-
&& rosdep update
21-
22-
RUN source /opt/ros/${ROS_DISTRO}/setup.bash \
23-
&& rosdep install -y --ignore-src --from-paths src --skip-keys slam_toolbox
24-
25-
RUN source /opt/ros/${ROS_DISTRO}/setup.bash \
26-
&& colcon build --symlink-install --packages-up-to grid_map
27+
RUN apt-get update && \
28+
rosdep update && \
29+
source /opt/ros/${ROS_DISTRO}/setup.bash && \
30+
rosdep install -y --ignore-src --from-paths src --skip-keys slam_toolbox && \
31+
apt-get clean && \
32+
rm -rf /var/lib/apt/lists/*
2733

34+
# Build
35+
RUN source /opt/ros/${ROS_DISTRO}/setup.bash && \
36+
colcon build --symlink-install --packages-up-to grid_map

0 commit comments

Comments
 (0)