Produce a distroless-based Docker image #18033
Closed
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.
This minimises the docker image by using a distroless-based runtime image.
This means:
To do both, we add a new stage that runs on the build platform arch (rather than the target platform) which sets up those environments for both x86-64 and aarch64.
For the former, we download the debs using
apt-get download
, and manually unarchive them.For the latter, we use
uv python
to download Python distributions from theindygreg/python-build-standalone
project.I then looked how I could further improve build speeds, especially when cross-compiling:
uv
anyway, I figured I could swappip install
calls withuv pip install
, which saves a few minutes by itselfhiredis
didn't have builds for py3.13 with the version we were usingrequirements.txt
is arch-agnostic, so I've switched this one to run on the build architecture, so that both arch can share it-slim
images, but still installed a bunch of-dev
dependencies. Turnsout, all the dev dependencies were already installed in the non-
slim
image, which saves a bunch of time as well