This repository was archived by the owner on Sep 8, 2025. It is now read-only.
Commit a068fd0
authored
feat(build): enhance container build times (#438)
This draft pr is intended to further discussing #424. It only comprises
the build for controlplane and provides a draft layout that could be
enrolled to other containers.
- based on Debian trixie slim
- using rustup via apt to install stable rust
- separated build and runtime container
- runtime container based on plain debian-slim (including apt, shell,
...)
- requires a workspace volume mount
- optionally supports a workspace/target volume mount to enable re-using
of compiled elements
- in case not mounted a full fledged build is executed
- all source code artefacts required for the build are copied into the
container
- this is currently the most time intense operation during re-usage of
pre-compiled elements
- CARGO_HOME is redefined to save downloaded dependencies into target/
```
$ time docker build -f build/Containerfile.controlplane -v "$(pwd):/workspace" -v "$(pwd)/target:/build/target/" --build-arg BUILD_TIMESTAMP=$(date +%s%3N)
[1/2] STEP 1/7: FROM debian:trixie-slim AS builder
[1/2] STEP 2/7: RUN apt update && apt install -y build-essential rustup && rustup install stable
--> Using cache 5dc77c2dd41693beebc66a306cf73312f5c9355dfcca1bbfdfa45a960c03b7e1
--> 5dc77c2dd416
[1/2] STEP 3/7: ARG BUILD_TIMESTAMP
--> Using cache 52db6776fc06faad520ef09bb1bdeb59125489af46afc0c35c6c9c7977e61eee
--> 52db6776fc06
[1/2] STEP 4/7: WORKDIR /build
--> Using cache 2862ae0bb1b14024eebbda34b432496c94bbe41a359932b351f0a4bd0470d514
--> 2862ae0bb1b1
[1/2] STEP 5/7: ENV CARGO_HOME=/build/target
--> Using cache 61f2d25c7adb3077b1b50f68ea3cf38a031cb31f17672f3257143f5dbc7f28b6
--> 61f2d25c7adb
[1/2] STEP 6/7: RUN echo "${BUILD_TIMESTAMP}" && date +%s && cp -a /workspace/Cargo.toml /workspace/Cargo.lock /workspace/controlplane/ /workspace/dataplane/ /workspace/tests-integration/ /workspace/tools/ /workspace/xtask/ /build
1755529247016
1755529248
--> ae88babc1118
[1/2] STEP 7/7: RUN date +%s && cargo build -p controlplane && date +%s && mkdir -p results/ && cp target/debug/controller results/
1755529254
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.21s
1755529254
--> 7452142d2300
[2/2] STEP 1/6: FROM debian:trixie-slim
[2/2] STEP 2/6: LABEL org.opencontainers.image.source=https://github.com/kubernetes-sigs/blixt
--> Using cache fd399516894249f40dc62e585e7f2816bf54cdac0987414cec291507bf59abf7
--> fd3995168942
[2/2] STEP 3/6: WORKDIR /
--> Using cache d63dbdec7772ab7fcd3423962f7bfe8b221a6b81d03236efd9307c3424607143
--> d63dbdec7772
[2/2] STEP 4/6: COPY --from=builder /build/results/controller /controller
--> Using cache 41a90ea11d0b008100a60b8c6aff04c335414efb09322e3f51bc4122bd8f45fd
--> 41a90ea11d0b
[2/2] STEP 5/6: USER 1000:1000
--> Using cache e7d41a49b6da537fa698e3ddc31a8ebaa41c2a6f12c7719d99219e9c80e128b0
--> e7d41a49b6da
[2/2] STEP 6/6: ENTRYPOINT [ "/controller" ]
--> Using cache a21a4a52596ea6a6adfa0c1e8731a73f83a882d46d1d4ffbe5d38e7dbf6342d7
--> a21a4a52596e
a21a4a52596ea6a6adfa0c1e8731a73f83a882d46d1d4ffbe5d38e7dbf6342d7
real 0m14.483s
user 0m1.076s
sys 0m0.129s
$
```
fixes: #424
Signed-off-by: Harald Gutmann <harald@gutmann.one>1 parent 8bd6c56 commit a068fd0
File tree
6 files changed
+250
-153
lines changed- .github/workflows
- build
- tests-integration/src/infrastructure
6 files changed
+250
-153
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
67 | 73 | | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
75 | 85 | | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
83 | 97 | | |
84 | 98 | | |
85 | 99 | | |
| |||
95 | 109 | | |
96 | 110 | | |
97 | 111 | | |
| 112 | + | |
98 | 113 | | |
99 | 114 | | |
100 | | - | |
| 115 | + | |
| 116 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
67 | 71 | | |
68 | 72 | | |
69 | 73 | | |
| |||
88 | 92 | | |
89 | 93 | | |
90 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
91 | 102 | | |
92 | 103 | | |
93 | | - | |
94 | | - | |
| 104 | + | |
| 105 | + | |
95 | 106 | | |
96 | 107 | | |
97 | | - | |
| 108 | + | |
| 109 | + | |
98 | 110 | | |
99 | 111 | | |
100 | 112 | | |
101 | | - | |
| 113 | + | |
| 114 | + | |
102 | 115 | | |
103 | 116 | | |
104 | 117 | | |
| |||
131 | 144 | | |
132 | 145 | | |
133 | 146 | | |
134 | | - | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
135 | 151 | | |
136 | 152 | | |
137 | 153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 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 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
28 | 45 | | |
29 | 46 | | |
30 | 47 | | |
31 | 48 | | |
32 | 49 | | |
33 | | - | |
| 50 | + | |
34 | 51 | | |
35 | 52 | | |
36 | 53 | | |
37 | 54 | | |
38 | 55 | | |
39 | 56 | | |
40 | 57 | | |
41 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
42 | 61 | | |
43 | 62 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 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 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
| 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 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
66 | 53 | | |
67 | 54 | | |
68 | 55 | | |
69 | 56 | | |
70 | 57 | | |
71 | | - | |
| 58 | + | |
72 | 59 | | |
73 | 60 | | |
74 | 61 | | |
75 | 62 | | |
76 | 63 | | |
77 | 64 | | |
78 | 65 | | |
79 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
80 | 69 | | |
81 | | - | |
| 70 | + | |
82 | 71 | | |
83 | | - | |
| 72 | + | |
84 | 73 | | |
85 | | - | |
| 74 | + | |
0 commit comments