build: Build amd64 and arm64 multi-platform Docker image#7952
build: Build amd64 and arm64 multi-platform Docker image#7952jeremylong merged 3 commits intodependency-check:mainfrom
Conversation
|
@jeremylong perhaps have a go with this locally to make sure build+test works for you? If you use MacOS you might need to I actively use buildx for other projects so I might have forgotten magic I did to initialize the builders etc which is otherwise taken care of by the GitHub action. if so, I can improve the scripting to create a deterministic builder - or ensure it creates one if not already created. |
|
I quickly tested this on macOS. buildx has been installed for years, but the
One needs to enable "Use containerd for pulling and storing images" in the settings. Is this the same reason you added the |
|
@marcelstoer thanks for that. Are you using docker desktop or something like Colima, rancher etc? I can understand why you’d get this with Docker Desktop given its default configuration, but not sure what my Colima install is doing to avoid this (I am using Colima with docker runtime) And yes, this is why the containerd snapshotter is being used on GHA. I thought it was perhaps a linux-only problem, where docker is native, but seems not. The alternative is to add more steps to manually export from the builder and then later import/load a single-arch tar into docker but it’s a pain-in-the-ass without slopes/regctl so I was hoping the simpler option works. As you can see from docker/buildx#59 (comment) this is an irritating saga that has been going on for years without simple functionality being addressed in docker so allow basic interoperability between buildx and the runtime/engine. |
|
Ahh, I see now why I don’t have an issue: abiosoft/colima#1360 Would it be sufficient if I added a shell test to the build script to fail fast if this isn’t enabled and point to instructions? |
|
Yes, I'm using Docker Desktop which has the containerd flag disabled by default.
That'd be way more than sufficient 😄 I have no objection to merging as-is as hardly anyone will run these scripts locally (I reckon). At $work, I opted for less efficient but more stable and risk free pipelines. We run |
|
Yeah, the issue is with running sanity tests before push, which requires you to get a built image into Docker Engine. Then you're in the land of all the 'traditional' commands on the docker CLI which cannot handle multi-arch images, nor OCI format etc.
|
|
@chadlwilson can you add the test for the build failure that points to the setup instructions as you mentioned above? I'm okay with the PR - I just think this would be helpful as we have people build things locally a lot and I want to avoid as many questions as we can. |
|
Ack, will do shortly |
Signed-off-by: Chad Wilson <29788154+chadlwilson@users.noreply.github.com>
…erd snapshotter This is currently required to do a `docker buildx build --load` alongside multi-platform build, due to needing a convenient workaround for docker/buildx#59 (comment) Signed-off-by: Chad Wilson <29788154+chadlwilson@users.noreply.github.com>
… scripts Signed-off-by: Chad Wilson <29788154+chadlwilson@users.noreply.github.com>
a2632e5 to
e949465
Compare
|
Rebased and added. Will now fail with: |
marcelstoer
left a comment
There was a problem hiding this comment.
This is great, thanks!
Description of Change
Uses docker buildx to build and push the docker image for
linux/arm64as well as existinglinux/amd64--load)linux/amd64on default runners.test-docker.shlocally on the arm64 image thoughSample images built and pushed using this approach: https://hub.docker.com/repository/docker/chadwilson/dependency-check/tags
See sample actions run at https://github.com/dependency-check/DependencyCheck/actions/runs/17936406550/job/51003624010?pr=7952
Related issues
Have test cases been added to cover the new functionality?
yes