Multi-arch images take 40 minutes because arm64 builds use QEMU. Fix it.
AdvancedScenarioSpeed, Caching & Cost
Answer
Situation read → Emulation is 5 to 20 times slower than native.
What I'd do →
- Matrix over native runners:
ubuntu-24.04(amd64) andubuntu-24.04-arm(arm64). - Each leg builds and pushes by digest only (
outputs: type=image,push-by-digest=true,name-canonical=true,push=true) and uploads the digest as artifactdigest-${{ matrix.arch }}. - Merge job downloads digests and runs
docker buildx imagetools create -t $IMAGE:$TAG $IMAGE@sha256:a $IMAGE@sha256:b.
Why → Native builds remove emulation entirely; the manifest list makes one tag serve both architectures.
Interview tip → Name the pattern: "build by digest per platform, merge manifest".
More on Speed, Caching & Cost
`npm ci` takes 4 minutes on every run. Fix it.BeginnerDocker builds take 12 minutes even when only one line of code changed. Speed them up.IntermediateThe repo hits the 10 GB cache limit daily and hit rates are poor. What do you change?IntermediatemacOS jobs are 60% of your bill. What are your options?IntermediateA job sometimes hangs and burns 6 hours. How do you stop it happening again?BeginnerYour PR matrix is 3 OS times 4 versions (12 jobs). How do you cut cost without losing coverage?Advanced