Commit 7d34678
authored
image.bzl: implement
rules_docker decides the name of the resulting docker image:
bazel/{target}:{name}
The repository (`bazel/` by default) and `{target}` are fine. However,
we want to customize the tag part -- the thing after the colon. This
patch allows customizing the last part.
Why?
====
In our case, we are always building two images for two architectures
using transitions. Here is an extract of a macro that builds two
containers:
Then we build two containers using outgoing transitions:
container_image(
name = "{name}-post_transition".format(name = name),
...,
)
multiplatform_image(
name = "{name}-amd64".format(name),
src_image = ":{name}-post_transition".format(name = name),
...,
)
multiplatform_image(
name = "{name}-arm64".format(name = name),
src_image = ":{name}-post_transition".format(name = name),
...,
)
Both images (`-amd64` and `-arm64`) build correctly, but the resulting
image name, according to Docker, happens to be
`bazel/{target}:{name}-post_transition`. So the internal implementation
details of the transitions leak to the resulting images.
This patch makes it possible to rename the post-transition image name to
something we like more, e.g. the architecture name, or remove the suffix
altogether.tag_name (#2205)1 parent 48ad6d6 commit 7d34678
File tree
5 files changed
+28
-5
lines changed- container
- docs
- testdata
- tests/container
5 files changed
+28
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
291 | | - | |
| 291 | + | |
| 292 | + | |
292 | 293 | | |
293 | 294 | | |
294 | 295 | | |
| |||
346 | 347 | | |
347 | 348 | | |
348 | 349 | | |
| 350 | + | |
349 | 351 | | |
350 | 352 | | |
351 | 353 | | |
| |||
367 | 369 | | |
368 | 370 | | |
369 | 371 | | |
| 372 | + | |
370 | 373 | | |
371 | 374 | | |
372 | 375 | | |
| |||
459 | 462 | | |
460 | 463 | | |
461 | 464 | | |
462 | | - | |
463 | | - | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
464 | 469 | | |
465 | 470 | | |
466 | 471 | | |
| |||
497 | 502 | | |
498 | 503 | | |
499 | 504 | | |
500 | | - | |
| 505 | + | |
501 | 506 | | |
502 | 507 | | |
503 | 508 | | |
| |||
744 | 749 | | |
745 | 750 | | |
746 | 751 | | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
747 | 755 | | |
748 | 756 | | |
749 | 757 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
404 | 404 | | |
405 | 405 | | |
406 | 406 | | |
407 | | - | |
| 407 | + | |
408 | 408 | | |
409 | 409 | | |
410 | 410 | | |
| |||
469 | 469 | | |
470 | 470 | | |
471 | 471 | | |
| 472 | + | |
472 | 473 | | |
473 | 474 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
100 | 106 | | |
101 | 107 | | |
102 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
935 | 935 | | |
936 | 936 | | |
937 | 937 | | |
| 938 | + | |
938 | 939 | | |
939 | 940 | | |
940 | 941 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
301 | 301 | | |
302 | 302 | | |
303 | 303 | | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
304 | 311 | | |
305 | 312 | | |
306 | 313 | | |
| |||
0 commit comments