Skip to content

Commit eeee2a7

Browse files
committed
Expand bullet points about optimizations
1 parent dba8a82 commit eeee2a7

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

ros/content.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -133,16 +133,18 @@ CMD ["ros2", "launch", "demo_nodes_cpp", "talker_listener_launch.py"]
133133

134134
The example above uses 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 dependencies sets using [`rosdep`](https://docs.ros.org/en/rolling/Tutorials/Intermediate/Rosdep.html). The `builder` stage apt installs the derived build dependencies, sources the ROS install underlay, and compiles the source via release mode using [`colcon`](https://docs.ros.org/en/rolling/Tutorials/Beginner-Client-Libraries/Colcon-Tutorial.html). Finally, `runner` stage apt 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:
135135

136-
- colcon
137-
- build cache if deps are unchanged
138-
- build and install select packages
139-
- Caching apt and rosdep
140-
- IO download
141-
- synchronizing apt lists
142-
- multi-state parallelization
143-
- Final Image Size
144-
145-
example uses the [`--mount`](https://docs.docker.com/engine/reference/builder/#run---mount) option to cache apt lists
136+
- Multi Stage Build
137+
- Dependency derivation, compilation, and runtime setup are partitioned
138+
- Maximums cache retention despite package source or build/runtime changes
139+
- Greater concurrency, e.g: colcon build while runtime apt instals
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 IO between stages or across docker rebuilds
144+
- Minimal Image Size
145+
- Final stage builds from `ros-core` for smallest runtime image
146+
- Builds and installs for just selected packages amongst workspace
147+
- Only workspace install artifacts are copied into final layers
146148

147149
For more advance 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.
148150

0 commit comments

Comments
 (0)