Skip to content
This repository has been archived by the owner on Aug 27, 2023. It is now read-only.

Add multi-arch support to build.sh #37

Merged
merged 2 commits into from
Jul 20, 2022
Merged

Conversation

ddelange
Copy link
Contributor

Will additionally push armv8 (arm64) and armv7 (32bit) docker images to dockerhub when a github release is (pre)released, or manually from the Actions tab after pushing a tag (but not releasing it as github release).

The script can still be used locally with a recent docker version that comes with buildx, also without QEMU emulator installed, to build and push the AMD image only (the default if BUILDX_PLATFORMS env var is not set)

pushing multi-arch manifest separately from the build command like it was is iffy (regctl needed), so just running build command again but with --push, which should be minimal overhead.

Comment on lines +18 to +19
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

these two you would have to add to https://github.com/stevearc/pypicloud-docker/settings/secrets/actions

which is safe as only you can trigger this workflow

Copy link
Owner

@stevearc stevearc left a comment

Choose a reason for hiding this comment

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

One small Q

.github/workflows/build.yml Outdated Show resolved Hide resolved
@stevearc
Copy link
Owner

LGTM, thanks for the PR

build:
runs-on: ubuntu-latest
env:
BUILDX_PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this env var can be customised also in local env: all available archs will be printed by QEMU setup

on:
release:
types: [released, prereleased]
workflow_dispatch: # allow manually running from the Actions tab
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@stevearc fwiw you as maintainer can trigger the flow manually for any branch from the Actions tab.

did the acript fail locally or in CI?

Copy link
Owner

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it wants an older version of psycopg-binary, which did not have aarch64_manylinux2014 wheels available yet 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

correction: just saw psycopg2-binary, with the 2. none of those have arm wheels available ;( solutions would be to add support for v3 (maybe no breaking changes that hit us), or prepare the dockerfile so the v2 install from source will succeed

Copy link
Contributor Author

@ddelange ddelange Aug 23, 2022

Choose a reason for hiding this comment

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

could try adding the apt package libpq-dev and see if source install in the arm image starts working

Copy link
Contributor Author

Choose a reason for hiding this comment

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

an alternative: https://github.com/docker/setup-buildx-action/blob/master/README.md#max-parallelism

although no space left can probably be avoided 'properly' as this should not be a heavy build

Copy link
Owner

Choose a reason for hiding this comment

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

Looks like most of the builds finish pretty quickly; it's just alpine linux on arm64 that's heavy. Kind of expected, since you can't use most binary packages and instead have to compile almost everything yourself https://github.com/stevearc/pypicloud-docker/runs/8039880052

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah yes, alpine... always a pain especially for python projects 😅 we once tried it at work cuz of 'smaller images' fetish, ended up quickly reverting to debian slim

Copy link
Owner

Choose a reason for hiding this comment

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

Finally managed to build and release 1.3.9 images! I ended up disabling the arm build on alpine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

whoop whoop!! 🎉 thanks so much for your perseverance 🙏

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants