perf(images): cap concurrent build steps at the runner's CPU count

Every distro builds both platforms in one job, so up to ten builds
share one builder on a four-vCPU runner, half of them under emulation.
BuildKit runs build steps without a parallelism limit unless
max-parallelism is set. The job now reads nproc and hands it to the
builder's buildkitd.toml, so steps beyond the CPU count wait instead
of overcommitting the runner.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5 committed 2026-09-21 20:26:14 +02:00
1 parent 3881eac5ef
commit 33c54828cc
1 file changed
+8
@@ -132,10 +132,18 @@ jobs:
shell: bash
run: docker run --privileged --rm "${{ steps.binfmt.outputs.ref }}" --install all
- name: 🧮 Count the runner's CPUs
id: cpus
shell: bash
run: echo "count=$(nproc)" >> "$GITHUB_OUTPUT"
- name: 🔧 Set up Docker Buildx
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
with:
driver-opts: image=${{ steps.buildkit.outputs.ref }}
buildkitd-config-inline: |
[worker.oci]
max-parallelism = ${{ steps.cpus.outputs.count }}
- name: 🔑 Login to GHCR
uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0