This is an automated email from the ASF dual-hosted git repository. Gerrrr pushed a commit to branch fix-multiarch-docker-build in repository https://gitbox.apache.org/repos/asf/otava.git
commit c52f5801e4c8fac29f448f5349a0f373467aa71b Author: Alex Sorokoumov <[email protected]> AuthorDate: Sun Apr 19 20:48:58 2026 -0700 Build multi-platform Docker images (amd64 + arm64) 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 --- .github/workflows/python-app.yml | 6 ++++++ docs/RELEASE.md | 16 +++++----------- tox.ini | 19 +++++++------------ 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 4ecd00a..53561d6 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -61,6 +61,12 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Set up Python uses: actions/setup-python@v5 with: diff --git a/docs/RELEASE.md b/docs/RELEASE.md index b5eb1a6..61bb699 100644 --- a/docs/RELEASE.md +++ b/docs/RELEASE.md @@ -411,23 +411,17 @@ twine upload --verbose apache_otava-$RELEASE_VERSION-py3-none-any.whl apache_ot ### Publish Docker Image -Build the image: +Ensure you have a multi-platform builder set up: ```bash -uv run tox -e docker-build +docker buildx create --name multiplatform --use || docker buildx use multiplatform ``` -Tag the image: +Log in to Dockerhub and build and push the multi-platform image: ```bash -docker tag apache/otava:latest apache/otava:$RELEASE_VERSION-incubating -``` - -Push the image to Dockerhub: - -```bash -docker push apache/otava:$RELEASE_VERSION-incubating -docker push apache/otava:latest +docker login +RELEASE_VERSION=$RELEASE_VERSION-incubating uv run tox -e docker-push ``` ### Remove old release candidates from dist.apache.org diff --git a/tox.ini b/tox.ini index d628acd..ee3abfb 100644 --- a/tox.ini +++ b/tox.ini @@ -67,8 +67,8 @@ commands = pre-commit run --all-files --hook-stage pre-push insert-license # docker-build and docker-push environments; docker-push requires -# RELEASE_VERSION (x.y.z), DOCKER_REGISTRY, DOCKER_REGISTRY_CREDS_USR and -# DOCKER_REGISTR_CREDS_PSW to be set +# RELEASE_VERSION (e.g. 0.7.0-incubating) to be set. +# Log in to Dockerhub (docker login) before running docker-push. [testenv:docker-{build,push}] skip_install = true allowlist_externals = @@ -77,21 +77,16 @@ allowlist_externals = passenv = SSH_AUTH_SOCK RELEASE_VERSION - DOCKER_REGISTRY - DOCKER_REGISTRY_CREDS_USR - DOCKER_REGISTRY_CREDS_PSW setenv = DOCKER_BUILDKIT=1 DOCKER_PROJECT=apache/otava UV_OPTS = -v commands = - docker buildx build --tag {env:DOCKER_PROJECT}:latest . - push: docker image tag {env:DOCKER_PROJECT}:latest {env:DOCKER_PROJECT}:{env:RELEASE_VERSION} - push: docker image tag {env:DOCKER_PROJECT}:{env:RELEASE_VERSION} {env:DOCKER_REGISTRY}/{env:DOCKER_PROJECT}:{env:RELEASE_VERSION} - push: docker image tag {env:DOCKER_PROJECT}:latest {env:DOCKER_REGISTRY}/{env:DOCKER_PROJECT}:latest - push: docker login -u {env:DOCKER_REGISTRY_CREDS_USR} -p {env:DOCKER_REGISTRY_CREDS_PSW} {env:DOCKER_REGISTRY} - push: docker image push {env:DOCKER_REGISTRY}/{env:DOCKER_PROJECT}:{env:RELEASE_VERSION} - push: docker image push {env:DOCKER_REGISTRY}/{env:DOCKER_PROJECT}:latest + build: docker buildx build --platform linux/amd64,linux/arm64 --tag {env:DOCKER_PROJECT}:latest . + push: docker buildx build --platform linux/amd64,linux/arm64 \ + --tag {env:DOCKER_PROJECT}:{env:RELEASE_VERSION} \ + --tag {env:DOCKER_PROJECT}:latest \ + --push . [pytest] # Ensure we do not include BUILD_DIR by explicitly specifying where to search for tests
