Commit e928eb1
authored
Space and Time Reduction (#60)
This is a pass to reduce build times and image sizes. The impact varies
but the general expectation is improvement.
Image size reductions of 18% - 30% and build time reductions of 7% - 35%
were found. Some results were greater yet less consistent and should not
be expected.
Changes to achieve this include:
* Caching introduced for `apt`, `npm`, `go`, static `ffmpeg` builds
* `apt` configuration changed to prevent automatic cache removal and to
preserve downloads
* Recommended `apt` packages are no longer installed
* Removal of unused packages
Manual testing was done. Further testing is requested to verify impact
and functionality. Particularly of interest are differing and
constrained environments such as CI/CD pipelines.
---
<!-- mesa-description-start -->
## TL;DR
Reduced Docker image sizes and build times by implementing widespread
caching for `apt`, `npm`, `go`, and `ffmpeg` builds.
## Why we made these changes
To reduce build times and image sizes for faster, more efficient CI/CD
pipelines and local development. Image size reductions of 18% - 30% and
build time reductions of 7% - 35% were observed in testing.
## What changed?
- **Implemented Widespread Caching:** Introduced Docker BuildKit cache
mounts (`--mount=type=cache`) across multiple Dockerfiles to cache
dependencies for `apt`, `npm`, `go`, and static `ffmpeg` builds.
- **Optimized `apt` Usage:** Configured `apt` to retain its cache and
consistently used the `--no-install-recommends` flag to prevent
installing unnecessary packages, minimizing image size.
- **Improved FFmpeg Reliability:** Added MD5 checksum validation to the
FFmpeg download process to ensure integrity.
- **Refined Package Lists:** Removed unused packages and added essential
ones like `gpg-agent` to ensure build reliability.
- **Configuration:** Added `.mise.toml` to `.gitignore`.
## Validation
Manual testing was done. Further testing is requested to verify impact
and functionality, particularly in differing and constrained
environments such as CI/CD pipelines.
<sup>_Description generated by Mesa. [Update
settings](https://app.mesa.dev/onkernel/settings/pull-requests)_</sup>
<!-- mesa-description-end -->
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Introduces BuildKit caching and apt optimizations across Dockerfiles,
adds FFmpeg checksum/caching, trims packages, and ignores .mise.toml to
reduce build times and image sizes.
>
> - **Dockerfiles**:
> - **Caching**:
> - Add BuildKit cache mounts for `go mod download`, `go build`, `npm
install/build`, and `apt`.
> - Cache static `ffmpeg` downloads with MD5 verification and reuse.
> - **apt optimization**:
> - Preserve apt caches; use `--no-install-recommends` consistently; add
`gpg-agent` where needed.
> - **Package set**:
> - Remove unused userland packages in headful image; split and minimize
installs (e.g., `sqlite3`).
> - **Chromium/Node**:
> - Keep Chromium via PPA; copy Node 22 toolchain; cache global npm
installs where applied.
> - **Xorg build stages**:
> - Use apt cache mounts and `--no-install-recommends` for `xorg-deps`
and `xf86-input-neko` builds.
> - **Repo**:
> - Update `.gitignore` to ignore `.mise.toml`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
05a63a1. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent a0dca70 commit e928eb1
File tree
6 files changed
+142
-62
lines changed- images
- chromium-headful
- client
- xorg-deps
- xf86-input-neko
- chromium-headless/image
6 files changed
+142
-62
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
15 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
16 | 20 | | |
17 | 21 | | |
18 | 22 | | |
| |||
23 | 27 | | |
24 | 28 | | |
25 | 29 | | |
26 | | - | |
| 30 | + | |
27 | 31 | | |
28 | | - | |
| 32 | + | |
29 | 33 | | |
30 | 34 | | |
31 | 35 | | |
32 | 36 | | |
33 | 37 | | |
34 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
35 | 43 | | |
36 | | - | |
37 | | - | |
38 | | - | |
| 44 | + | |
| 45 | + | |
39 | 46 | | |
40 | 47 | | |
41 | 48 | | |
| |||
61 | 68 | | |
62 | 69 | | |
63 | 70 | | |
64 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
65 | 76 | | |
66 | | - | |
| 77 | + | |
| 78 | + | |
67 | 79 | | |
68 | 80 | | |
69 | 81 | | |
| |||
95 | 107 | | |
96 | 108 | | |
97 | 109 | | |
98 | | - | |
99 | | - | |
| 110 | + | |
100 | 111 | | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | 112 | | |
105 | | - | |
106 | | - | |
107 | 113 | | |
108 | 114 | | |
109 | 115 | | |
110 | 116 | | |
111 | | - | |
112 | | - | |
| 117 | + | |
113 | 118 | | |
114 | 119 | | |
115 | 120 | | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
123 | 149 | | |
| 150 | + | |
124 | 151 | | |
125 | 152 | | |
126 | 153 | | |
127 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
128 | 157 | | |
129 | | - | |
| 158 | + | |
130 | 159 | | |
131 | 160 | | |
132 | 161 | | |
| |||
138 | 167 | | |
139 | 168 | | |
140 | 169 | | |
141 | | - | |
| 170 | + | |
142 | 171 | | |
143 | 172 | | |
144 | 173 | | |
| |||
153 | 182 | | |
154 | 183 | | |
155 | 184 | | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
| 185 | + | |
160 | 186 | | |
161 | 187 | | |
162 | | - | |
163 | | - | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
164 | 196 | | |
165 | 197 | | |
166 | 198 | | |
| |||
174 | 206 | | |
175 | 207 | | |
176 | 208 | | |
177 | | - | |
| 209 | + | |
178 | 210 | | |
179 | 211 | | |
180 | 212 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
8 | 12 | | |
9 | | - | |
10 | | - | |
11 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
12 | 16 | | |
13 | 17 | | |
14 | 18 | | |
| |||
Lines changed: 7 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
6 | 10 | | |
7 | | - | |
8 | | - | |
9 | | - | |
| 11 | + | |
| 12 | + | |
10 | 13 | | |
11 | 14 | | |
12 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
17 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
18 | 22 | | |
19 | 23 | | |
20 | 24 | | |
| |||
23 | 27 | | |
24 | 28 | | |
25 | 29 | | |
26 | | - | |
27 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
28 | 35 | | |
29 | | - | |
| 36 | + | |
30 | 37 | | |
31 | 38 | | |
32 | 39 | | |
| |||
43 | 50 | | |
44 | 51 | | |
45 | 52 | | |
46 | | - | |
| 53 | + | |
47 | 54 | | |
48 | 55 | | |
49 | 56 | | |
50 | 57 | | |
51 | 58 | | |
| 59 | + | |
52 | 60 | | |
53 | 61 | | |
54 | 62 | | |
| |||
58 | 66 | | |
59 | 67 | | |
60 | 68 | | |
61 | | - | |
62 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
63 | 77 | | |
64 | 78 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
72 | 107 | | |
| 108 | + | |
73 | 109 | | |
74 | 110 | | |
75 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
76 | 114 | | |
77 | 115 | | |
78 | 116 | | |
| |||
0 commit comments