Publish multi-architecture (amd64 + arm64) Docker images
- Dominant language
- Python
- Stars
- 564
- Forks
- 88
- PR merge metrics
- No merged PRs in 30d
Description
### Problem
The Docker images published to GHCR (`ghcr.io/google/slo-generator`) and GCR are single-architecture (amd64 only). Running them on arm64 nodes (e.g., AWS Graviton instances on EKS) fails with:
```
exec /usr/local/bin/slo-generator: exec format error
```
This can be confirmed by inspecting the manifest:
```bash
docker buildx imagetools inspect ghcr.io/google/slo-generator:2.6.0
```
which returns a single `application/vnd.docker.distribution.manifest.v2+json` instead of a manifest list.
Since slo-generator is a pure Python application and the Dockerfile already uses `python:3.11-alpine` (which supports both `linux/amd64` and `linux/arm64`), there's nothing preventing multi-arch builds — the CI workflows just don't set it up.
### Proposed fix
**1. `.github/workflows/build-and-push-to-ghcr.yml`**
Add QEMU and buildx setup, and specify `platforms`:
```yaml
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
PYTHON_VERSION=${{ vars.PYTHON_VERSION }}
```
**2. `.github/workflows/build-and-push-to-gcr.yml`**
The GCR workflow uses `gcloud builds submit` via Cloud Build, which also only builds for amd64 by default. This would need either:
- Switching to `docker/build-push-action` with multi-platform support (like the GHCR workflow), or
- Adding a multi-arch Cloud Build config
### Why this matters
arm64 instances (AWS Graviton, GCP Tau T2A) are increasingly common in Kubernetes clusters for cost and performance reasons. Many clusters run mixed-architecture node pools, and amd64-only images require workarounds like node affinity rules to avoid scheduling failures.
Contributor guide
Assessment
This issue has not been assessed yet.