Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multi platform Docker build (buildx) #151

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

janhoy
Copy link
Contributor

@janhoy janhoy commented Apr 14, 2023

Building on my mac (M1) I only get an arm64 build, and it does not work on intel machines. So I need to build with multi architectures. This PR enables that. (still testing)

@janhoy janhoy requested a review from a team as a code owner April 14, 2023 13:44
pom.xml Outdated Show resolved Hide resolved
@janhoy
Copy link
Contributor Author

janhoy commented Jan 25, 2024

I think this is ready, can someone review?

@ksclarke
Copy link
Member

I have a Mac now to test with. I'll get this done tomorrow before doing the new Cantaloupe release.

@janhoy
Copy link
Contributor Author

janhoy commented Jan 26, 2024

Also, today you only push amd64 image to hub. Could you look at officially publishing arm image as well. Not just for Mac but many Linux systems now run arm.

@ksclarke
Copy link
Member

Looking into GitHub Action arm runners.

@janhoy
Copy link
Contributor Author

janhoy commented Jan 27, 2024

Looking into GitHub Action arm runners.

I see several explicit amd64 references in Dockerfile (kakadu) and perhaps elsewhere, so probably needs more effort if you want to take advantage of some of the native libraries being pulled in. However, wrt docker image builds, it should be fully possible to build both amd and arm images on the same runner through use of docker buildx.

@ksclarke
Copy link
Member

@janhoy Re: "However, wrt docker image builds, it should be fully possible to build both amd and arm images on the same runner through use of docker build."

Is that right? It looks to me like the docker-maven-plugin builds the image for the platform on which the build is happening if it's one of the supplied ${docker.platforms} when more than one is supplied. That makes me think we could have a ${docker.platforms} value for all supported platforms, but that we'll need a runner for each of those platforms(?)

Cf. https://dmp.fabric8.io/#build-buildx

@ksclarke
Copy link
Member

One of our programmers is going to look into running Mac GitHub Action runners to get automated builds (minus the Kakadu stuff) using that going.

@janhoy
Copy link
Contributor Author

janhoy commented Feb 9, 2024

Is that right? It looks to me like the docker-maven-plugin builds the image for the platform on which the build is happening

If you continue reading on that same page, you will find that:

These rules only apply to the image built and loaded into the local image cache with the build goal. They do not apply to the push goal which will always build and push either a single-architecture or multi-architecture image with whatever platforms are specified in the element.

I.e. a developer will get a local build for her own platform when invoking "build" target. But during release, when you invoke the "push" target, buildx will build and push all architectures (using QEmu) as normal.

@ksclarke
Copy link
Member

ksclarke commented Oct 17, 2024

Just updating this ticket... The build works as a multi-arch build, but to do the deploy/release I have to replace the overlayfs in my local Docker install with a custom containerd-snapshotter config (suggested by fabric8io/docker-maven-plugin#1557 (comment) (after you go down the rabbit hole a bit)). This is a result, it seems, of docker-maven-plugin using --load in the release vs. --push.

I can do this locally (and push to DockerHub), but cannot do this on GitHub Actions (I don't think) unless I configure a Docker-in-Docker setup (or run my Actions runner as a self-hosted runner). Still working on it though...

Edit: Actually, this seems to only be a problem when also trying to do attestation (sbom/provenance) with the multiarch release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants