Does anyone have tips for producing multi-arch ima...
# general
g
Does anyone have tips for producing multi-arch images so that I can publish a arm64 and amd64 image using the same tag?
b
We do this outside of Pants - IDK if that's an option for you, but what we do is generate PEX files for the different architectures using Pants and then execute the Docker builds using an external service instead
g
@better-van-82973 which external service?
b
We use https://namespace.so/ now - we’ve also used https://depot.dev/ in the past
👍 1
Both are pretty good and support building multi-arch images + pushing to a registry for the same tag / SHA
🙌 1
n
That should be possible with the Docker backend - see https://github.com/pantsbuild/example-docker/pull/12 (@broad-processor-92400 could you merge this?).
b
Can do, but it has a merge conflict; could you resolve?
b
The one thing I'll say is suboptimal about the approach in that PR is that it runs on one architecture and uses QEMU to emulate the other one - we used to do this before and it was much slower than using another service that gives you native x86+ARM builders instead
n
Yes, for sure, it won't be as efficient as the other services you mentioned. But if you only have a couple images, it's an option.
👍 1
m
We've done this by manually creating / pushing the manifest... Flow looks like: • parallel ARM and AMD CI jobs for building per-arch images (with
arm-
or
amd-
prefix) • Job that executes :
Copy code
docker manifest create "${IMAGE}:${TAG}" ${IMAGE}:arm-${TAG} ${IMAGE}:amd-${TAG}
docker manifest push --purge "${IMAGE}:${TAG}"
g
@modern-london-16641 Thanks for that! I read about
docker manifest
and am likely to use it. I also found manifest-tool which looks interesting, but I'm slightly confused why it's used over
docker
native. I haven't dug deep, but I imagine it makes some things easier.
m
Yeah, not 100% sure.. The native docker cli seemed easy enough. But perhaps if you wanted to do some fancier things / prefer yaml over shell it'd make sense