Commit 9bdf01d
committed
Fix #858: tell buildx which platform to build for
Docker builds on GitHub are failing with the problem that Docker build
is trying to get qsim images from docker.io:
```
#1 [internal] load local bake definitions
#1 reading from stdin 935B done
#1 DONE 0.0s
#2 [qsim internal] load build definition from Dockerfile
#2 transferring dockerfile: 1.34kB done
#2 DONE 0.0s
#3 [qsim-py-tests internal] load build definition from Dockerfile
#3 transferring dockerfile: 381B done
#3 DONE 0.0s
#4 [qsim-cxx-tests internal] load build definition from Dockerfile
#4 transferring dockerfile: 208B done
#4 DONE 0.0s
#5 [qsim-cxx-tests internal] load metadata for #docker.io/library/qsim:latest
```
Apparently, this happens because the `buildx` plugin, which is the
default builder in many modern Docker setups, can build images in
parallel and uses an isolated builder environment. An image built for
one service (like `qsim`): might not be immediately loaded into the
local Docker daemon's image store. When the build for a dependent
service (like `qsim-cxx-tests`) starts, it can't find the `qsim` base
image locally and falls back to searching Docker Hub.
While `depends_on` controls the runtime start order of containers, the
build-time dependency inference can be tricky in this parallel execution
environment.
One way to fix this is to explicitly tell `buildx` which platform to
build for. This forces buildx to build a single-platform image and load
its layers into the local image store, making it available to subsequent
build steps.1 parent 7932f78 commit 9bdf01d
1 file changed
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| 19 | + | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
| |||
0 commit comments