-
Notifications
You must be signed in to change notification settings - Fork 559
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
How to build multi platform image in different runners #671
Comments
Found an action which can manually push the manifest however it would be nice if there would be an official way of doing that via the build action directly https://github.com/Noelware/docker-manifest-action |
I have the same issue. Any update on the matter ? |
Just tried to use a matrix to build my ResourceSpace container in six different pipelines, as it saves a lot of time for each image to finish. But as reported, each finished pipeline overwrites the result of the priorly finished one and I end up with just the riscv64 image. It would be great if the tags section could support some kind of platform/architecture tagging. Just to demonstrate the benefit of proper matrix support: |
@crazy-max - any thoughts on this? As ARM builds become more popular, the QEMU based builds are just way too painfully slow. Having proper matrix support here would be fantastic! |
I was running into this problem as well and after a bit of searching, I landed on building/pushing each of my desired architectures and then creating the manifest in a subsequent job for the workflow. I have an ARM device and an amd64 device so I build on the appropriate architecture which seems to rule out using matrix builds. It's not nearly as clean as it looked when I was using the matrix approach... but it seems to work alright.
|
https://dev.to/aws-builders/using-docker-manifest-to-create-multi-arch-images-on-aws-graviton-processors-1320 has a good writeup of Chris' style of fixing this. The one thing that sucks for me is that the PS: you can get commercially hosted ARM runners from https://gitrunners.com . I just started trialling them, and they seem to be pretty decent. |
We have actuated customers running split builds on native Arm too. My example uses two separate steps followed by a final one to publish a manifest. What exactly was the issue with the matrix build? The de-duplication is rather nice. |
The two issues I encountered are
|
We have published a new documentation to distribute build across runners: https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners Ofc best is to use native nodes to avoid using emulation. This can be done when configuring your builder: https://docs.docker.com/build/ci/github-actions/configure-builder/. See https://github.com/docker/packaging/blob/2c95ad0ca93ea91a01755b01e9a979adec955540/.github/workflows/.release.yml#L68-L89 as an example. |
ooo |
Yes and also with this workflow it pushes by digest and therefore avoid noisy tags on your registry such as |
@crazy-max Is it possible to use caching ( |
@neilime Sure with something like: jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm/v6
- linux/arm/v7
- linux/arm64
steps:
-
name: Prepare
run: |
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
-
name: Checkout
uses: actions/checkout@v3
-
...
-
name: Build and push by digest
id: build
uses: docker/build-push-action@v4
with:
context: .
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
cache-from: type=gha,scope=build-${{ env.PLATFORM_PAIR }}
cache-to: type=gha,scope=build-${{ env.PLATFORM_PAIR }} |
… things, avoiding matrix etcera
Looking for a easier more encapsulated fix for this. ARM builds on ubuntu latest runner work but take ~ 7 times longer (6 mins vs 43 mins). If I could pass in an input parameter for the runner used for each platform architecture instead of having to setup this more complex digest merge and push it would be supper helpful. |
@paulbourelly999 I've since moved all my builds to https://depot.dev/ and have been very satisfied with the results. |
Good to hear about your experience @DavidS-ovm - there are a bunch of competing solutions out there now that look like clones of each other, I think we'll see even more of them to come. To update on my comment from June last year - we've been thousands of builds for the CNCF's Arm needs - feel free to check that out: The state of Arm CI for the CNCF. |
I solved this issue with using self-hosted github runners.
hope it helps. good luck |
How do you actually build the arm64 image/layers on a self-host arm64 agent running on EKS? I assume that docker buildx doesn't work on containers based nodes - i.e. no Docker. But I guess with your approach, the arm64 runner could use something like Kaniko or some other image builder that doesn't need Docker. |
Troubleshooting
Before submitting a bug report please read the Troubleshooting doc.
✅ went through the doc
Behaviour
I am building the same image on different runners:
reason for multiple runners is that QEMU emulation cant compile
clang-tidy
on-time with regularubuntu-latest
runners and the job times out after 6 hours.Docker build section does include which platform it is building:
Each runner then builds its own
platform
and pushes to github container registry. However the final image when you pull from github container registry is always for a single architecture and does not have any manifests:What is the correct way to build multi-platform image on different runners. I dont see any appropriate flag for that in the README
Steps to reproduce this issue
Expected behaviour
Final github package should be multi-platform
Actual behaviour
In my case since ARM build takes longer its the last push and the final image is ARM-only.
Configuration
Logs
logs_11.zip
The text was updated successfully, but these errors were encountered: