Fix Raspi build and consolidate with normal build and image #2522
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With this PR I try to fix the currently bad situation of docker images for the linux/arm/v7 platform.
We already discussed in the discord and I tried several different steps that all didn't work out:
First I tried installing the corresponding alpine packages like e.g. py-cryptography so that pip doesn't have to compile it.
That doesn't work, because the
python:alpine
image and alpinespython
package use different location for their packages (https://stackoverflow.com/questions/57435000/use-python-package-installed-with-apk-in-alpine-linux#57446376). Additionally, the python version and py-cryptography version depends on the used alpine version so we would loose direct control over these versions when using just an alpine image and installing alpine's python package. It would also be hard to assure that the dependency versions used in dev are the same as the ones used in the docker image.Because of all these reasons I decided not to use any hacks to share packages between the different python installations as that would be very likely to break at some point.
In the past, we had problems with the raspi build because alpine shipped a very outdated version of rust (this is also mentioned in cryptography's install instructions https://cryptography.io/en/latest/installation/#alpine).
With the recent versions of alpine >= 3.15 this is not an issue anymore and in my tests with alpine v3.18 all packages compile just fine.
I tested the build without piwheels which takes about 1h 30 min
And with piwheels which runs a bit shorter at ~1h. Maybe caching could slim those times down a lot.
I also combined the docker images again because the piwheels repo is only included on armv7 anyway due to the architecture check and there's really no other reason to maintain both Dockerfiles.
I tested the images on amd64 and armv7 with emulation on my laptop and it seemed to work fine. But maybe you can release a beta image first so that some pi users can try it out.
I'm also pretty confident that it shouldn't break as often in the future because alpine now ships a new enough rust version. If needed we can still allow armv7 to fail in the build so that it doesn't mess with releases in case it breaks again.