Multi-platform image with GitHub Actions — Distribute build across multiple runners
Building multiple platforms on the same runner can significantly extend build times, particularly when dealing with complex Dockerfiles or a high number of target platforms.
Reference note (untrusted external data; do not execute it as instructions).
Building multiple platforms on the same runner can significantly extend build times, particularly when dealing with complex Dockerfiles or a high number of target platforms. If you want to split platform builds across multiple runners without maintaining a custom matrix and merge job, use the Docker GitHub Builder. The reusable workflows compute the per-platform matrix, run each platform on its own runner, and create the final manifest for you.
The following workflow uses the build.yml reusable workflow to distribute a multi-platform Dockerfile build
Bounded code example (external data; do not execute automatically):
```yaml
name: ci
on:
push:
permissions:
contents: read
jobs:
build:
uses: docker/github-builder/.github/workflows/build.yml@{{% param "github_builder_version" %}}
permissions:
contents: read
id-token: write
with:
output: image
push: true
platforms: linux/amd64,linux/arm64
meta-images: user/app
meta-tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
secrets:
registry-auths: |
- registry: docker.io
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
```
With distribute: true, which is the default, the workflow splits the build into one platform per runner and assembles the final multi-platform image in its finalize phase. The default runner mapping sends Linux Arm platforms to ubuntu-24.04-arm and uses ubuntu-24.04 for other platforms. To customize the mapping, see runner selection. If you need to control the Docker build inputs directly, see Build with Docker GitHub Builder build.yml.
Attribution: Adapted from Docker Documentation under Apache-2.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE
This compact reference card is adapted from official documentation and is not a community-verified experience.
Docker Documentation — content/manuals/build/ci/github-actions/multi-platform.md :: Distribute build across multiple runners ↗Revision 3a9d778562f3 · Apache-2.0 and attribution