Skip to content

Build multi-platform Docker images (amd64 + arm64)#149

Merged
Gerrrr merged 2 commits into
masterfrom
fix-multiarch-docker-build
Apr 22, 2026
Merged

Build multi-platform Docker images (amd64 + arm64)#149
Gerrrr merged 2 commits into
masterfrom
fix-multiarch-docker-build

Conversation

@Gerrrr
Copy link
Copy Markdown
Contributor

@Gerrrr Gerrrr commented Apr 20, 2026

The docker buildx build command had no --platform flag, so images were built only for the host architecture. This caused examples to fail on amd64 when the published image was arm64-only.

  • Add --platform linux/amd64,linux/arm64 to buildx commands in tox.ini
  • Add QEMU and Buildx setup steps to CI workflow
  • Simplify tox docker-push to push directly to Dockerhub
  • Update RELEASE.md to use tox -e docker-push
  • Switch base Docker image to python:3.14.1-slim and bump numpy version
    for 3.14 to avoid building numpy within amd64 container.

@Gerrrr Gerrrr force-pushed the fix-multiarch-docker-build branch from c52f580 to d0e9077 Compare April 20, 2026 04:40
The docker buildx build command had no --platform flag, so images were
built only for the host architecture. This caused examples to fail on
amd64 when the published image was arm64-only.

- Add --platform linux/amd64,linux/arm64 to buildx commands in tox.ini
- Add QEMU and Buildx setup steps to CI workflow
- Simplify tox docker-push to push directly to Dockerhub
- Update RELEASE.md to use tox -e docker-push
- Switch base Docker image to python:3.14.1-slim and bump numpy version
for 3.14 to avoid building numpy within amd64 container.
@Gerrrr Gerrrr force-pushed the fix-multiarch-docker-build branch from d0e9077 to 34ae879 Compare April 20, 2026 05:34
@Gerrrr Gerrrr marked this pull request as ready for review April 20, 2026 05:39
Copy link
Copy Markdown
Contributor

@henrikingo henrikingo left a comment

Choose a reason for hiding this comment

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

Did you run this somewhere? I assume yes, but if so, where should I expect to see docker images coming through on the other side.

bump numpy version for 3.14 to avoid building numpy within amd64 container.

Why?

steps:
- uses: actions/checkout@v4

- name: Set up QEMU
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Probably better in its own commit, but why is the workflow called python-app :-D

@Gerrrr
Copy link
Copy Markdown
Contributor Author

Gerrrr commented Apr 22, 2026

Did you run this somewhere? I assume yes, but if so, where should I expect to see docker images coming through on the other side

Why?

These are connected stories :)

First, I added buildx to tox and CI to build the image for both architectures. The CI succeeded, but took 4 times longer (36 minutes instead of 9). While waiting for that CI job to finish, I decided to run it locally to find the potential issues sooner. On my personal laptop, uv run tox -e docker-build failed with out of memory error while building numpy. It turned out that building numpy via QEMU takes forever AND consumes a ton of memory as it builds a bunch of C/C++ libraries.

Why did the docker-build build numpy instead of just using the wheels? Numpy provides wheels for Python 3.14 only starting with version 2.3.2... but that version only supports Python >=3.11.

The combination of these issues lead me to upgrading numpy for Python 3.14 which in turn enabled fast cross-arch builds. As a result of these changes, GH CI runs in 4.5 minutes instead of 9/36 (baseline/multiarch) and does not crash with cryptic errors on Macbook Air 2022.

where should I expect to see docker images coming through on the other side.

We do not have yet a release CI job automating publishing to Dockerhub and PyPI. For the release process, you'll need to 1) check out the accepted version's tag and 2) build locally, then push to Dockerhub. I updated the release instructions in this PR.

@henrikingo
Copy link
Copy Markdown
Contributor

Ok thanks for the explanation.

For the release process, you'll need to 1) check out the accepted version's tag and 2) build locally, then push to Dockerhub.

I'll see what I can do about automating this. I don't think that we should publish release that someone built on their laptop. But I'd rather proceed with the release and designate the docker parts experimental. IMO the python parts deserve a releast now and shouldn''t be blocked

@henrikingo
Copy link
Copy Markdown
Contributor

I'm +1 on this if nobody else has any comments. Leaving to Alex to merge though.

Copy link
Copy Markdown
Contributor

@smccarthy788 smccarthy788 left a comment

Choose a reason for hiding this comment

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

Looks good, thanks @Gerrrr for keeping building time in mind.

@Gerrrr Gerrrr merged commit 1ceb153 into master Apr 22, 2026
6 checks passed
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.

3 participants