CircleCI-Public / cimg-python

The Next-Gen CircleCI Python Docker Convenience Image.
https://circleci.com/developer/images/image/cimg/python
MIT License
32 stars 30 forks source link

Add arm64 support #207

Closed BytesGuy closed 1 year ago

BytesGuy commented 1 year ago

Description

Add arm64 support to the cimg/python image by using buildx to build multi arch images.

The majority of the work actually lives in the cimg-shared repo which is where the build commands are generated:

https://github.com/CircleCI-Public/cimg-shared/pull/83 https://github.com/CircleCI-Public/cimg-shared/pull/84 https://github.com/CircleCI-Public/cimg-shared/pull/85

The main change to the Dockerfile here is the switch to the USER directive. sudo in buildx builds generally causes errors when running Docker on linux.

See also changes to cimg-orb:

https://github.com/CircleCI-Public/cimg-orb/pull/51

Notes for Python:

The builds with buildx are super slow, so I am not 100% happy with the current build workflow for this image in particular. Ideally we need to split this into building on native platforms and combine the manifest, but for now this current solution may work.


Note: The browsers variant does not build for arm64, only amd64, due to a limitation with selenium server. We will address this in the future, once arm64 support is rolled out to the majority of images

Test build with buildx: https://app.circleci.com/pipelines/github/CircleCI-Public/cimg-python/569/workflows/8cde5db1-d47b-47f1-ba7c-13b343a1879d

Reasons

To build multi architecture images and allow cimg/python to run on arm64 natively

Checklist

Please check through the following before opening your PR. Thank you!