You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The example above consists of three sequential stages. The `cacher` stage first updates the apt lists and ROS index, uses [`vcstool`](https://github.com/dirk-thomas/vcstool) to clone a demo repo into the workspace source directory, and derives build and runtime dependency sets using [`rosdep`](https://docs.ros.org/en/rolling/Tutorials/Intermediate/Rosdep.html). The `builder` stage installs the derived build dependencies, sources the ROS install underlay, and compiles the source in release mode using [`colcon`](https://docs.ros.org/en/rolling/Tutorials/Beginner-Client-Libraries/Colcon-Tutorial.html). Finally, the `runner` stage installs only runtime dependencies, copies the compiled workspace artifacts, and sets up the environment to launch the demo. Note the example consists of several subtle optimizations:
135
135
136
136
- Multi-Stage Build
137
-
- Dependency derivation, compilation, and runtime setup are partitioned
138
-
- Maximizes cache retention despite package source or build/runtime changes
139
-
- Greater concurrency, e.g., colcon build while runtime apt installs
137
+
- Dependency derivation, compilation, and runtime setup are partitioned
138
+
- Maximizes cache retention despite package source or build/runtime changes
139
+
- Greater concurrency, e.g., colcon build while runtime apt installs
140
140
- Persistent Cache Propagation
141
-
- Use of [`--mount`](https://docs.docker.com/engine/reference/builder/#run---mount) to cache temp data without bloating layers
142
-
- Maintain temporally consistent apt lists between parallel stages
143
-
- Avoid needless network I/O between stages or across Docker rebuilds
141
+
- Use of [`--mount`](https://docs.docker.com/engine/reference/builder/#run---mount) to cache temp data without bloating layers
142
+
- Maintain temporally consistent apt lists between parallel stages
143
+
- Avoid needless network I/O between stages or across Docker rebuilds
144
144
- Minimal Image Size
145
-
- Final stage builds from `ros-core` for smallest runtime image
146
-
- Builds and installs only a select few packages in the workspace
147
-
- Only workspace install artifacts are copied into final layers
145
+
- Final stage builds from `ros-core` for smallest runtime image
146
+
- Builds and installs only a select few packages in the workspace
147
+
- Only workspace install artifacts are copied into final layers
148
148
149
149
For comparison, the resulting `runner` image is similar in size to the earlier `installer` example. This allows you to develop and distribute custom ROS packages without significantly increasing image size compared to pre-built Debian installations:
150
150
@@ -160,7 +160,7 @@ rolling-ros-core 489MB
160
160
rolling 876MB
161
161
```
162
162
163
-
For more advanced examples, such as daisy-chaining multiple overlay workspaces to improve caching of Docker image build layers, using tools such as ccache to accelerate compilation with colcon, or using BuildKit to save build time and bandwidth even when dependencies change, the project `Dockerfile`s in the [Navigation2](https://github.com/ros-planning/navigation2) repo are excellent resources.
163
+
For more advance examples such as daisychaining multiple overlay workspaces to improve caching of docker image build layers, using tools such as ccache to accelerate compilation with colcon, or using buildkit to save build time and bandwidth even when dependencies change, the project `Dockerfile`s in the [Navigation2](https://github.com/ros-planning/navigation2) repo are excellent resources.
0 commit comments