Skip to content

Build arm64 images natively instead of emulating them - #70

Merged
kdambekalns merged 2 commits into
mainfrom
task/native-arm64-builds
Nov 5, 2026
Merged

kdambekalns merged 2 commits into
mainfrom
task/native-arm64-builds

Conversation

@kdambekalns

@kdambekalns kdambekalns commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

The nightly build takes up to 150 minutes, almost all of it emulating arm64 with QEMU. Run of 2026-11-04, PHP 8.4: amd64 5.8 min, arm64 89 min.

This builds every platform natively on a runner of its own:

  • prepare determines the latest release tag once
  • build: matrix PHP × platform, linux/amd64 on ubuntu-24.04, linux/arm64 on ubuntu-24.04-arm (free for public repositories). Each job pushes its image to both registries by digest only, so no tag points at a single-platform image at any time.
  • merge combines the two digests of every PHP version into one manifest list with docker buildx imagetools create and tags it (8.4, 8.4.27) in Docker Hub and Harbor. Each registry gets the list from its own blobs. It fails if a version does not have exactly two digests.
  • announce dispatches to docker-beach-php and docker-composer as before, now after merge

The PHP versions are still listed once, in the build matrix; merge reads them from the names of the digest artifacts. The registry cache is kept per platform (php-build-cache:8.4-amd64, …-arm64); the old php-build-cache:8.4 entries can be deleted from Harbor once this runs.

Tested: actionlint is clean; the shell of the merge step was run locally against fake artifacts, including a missing platform.

Test run (workflow_dispatch on this branch, https://github.com/flownative/docker-php/actions/runs/41892094170): 10 min instead of ~150. Build jobs 5–9 min each, merge 1 min. All tags in Docker Hub and Harbor carry amd64 and arm64, the version label is correct, and the dispatched builds of docker-beach-php (8 min) and docker-composer (4 min) succeeded on top of the new images.

Refs OPS-8R (https://minka.flownative.com/go/card/OPS-8R)

Emulating arm64 with QEMU on the amd64 runners took about 90 minutes per
PHP version (amd64 itself: about 6), so a nightly run took up to 150
minutes. Every platform now builds on a native runner of its own
(ubuntu-24.04 and ubuntu-24.04-arm), pushes by digest only, and a merge
job combines the digests into one manifest list per PHP version and tags
it in both registries.

The PHP versions stay listed once, in the build matrix; the merge job
takes them from the names of the digest artifacts. The registry cache is
now kept per platform.

Refs OPS-8R

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kdambekalns
kdambekalns marked this pull request as ready for review November 4, 2026 19:18
kdambekalns referenced this pull request Nov 4, 2026
The GitHub Actions cache evicts layer blobs while the cache index
still references them. BuildKit then fails the build instead of
treating this as a cache miss.

Store the build cache in Harbor instead, using one cache reference
per PHP minor version. A new patch release thus overwrites the
cache of the previous one instead of leaving it behind in the
registry.
Comment thread .github/workflows/docker.build.yaml Resolved
@kdambekalns kdambekalns self-assigned this Nov 5, 2026

@kdambekalns kdambekalns left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@kdambekalns
kdambekalns merged commit a273630 into main Nov 5, 2026
8 checks passed
@kdambekalns
kdambekalns deleted the task/native-arm64-builds branch November 5, 2026 07:49
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