Dockerfile: pin the uv builder image, and actually drop the apt lists - #1410
Open
sujeito-operator wants to merge 2 commits into
Open
Dockerfile: pin the uv builder image, and actually drop the apt lists#1410sujeito-operator wants to merge 2 commits into
sujeito-operator wants to merge 2 commits into
Conversation
COPY --from= here names an external image, not an earlier stage, so :latest leaves the tool that builds the wheel floating between builds.
apt-get clean empties /var/cache/apt/archives (the downloaded .debs). The indices apt-get update fetched live in /var/lib/apt/lists and survive it, so they ship in the image.
Member
|
I agree the rm would help but not the pinning of uv. I do not track uv security or release and uv as a tool should not change its behaviour so latest version would have no difference. If you update the patch to only include the remove I will merge it, if not I will likely add the line myself and commit it and then close this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Two small build-hygiene fixes, one commit each, so you can take either on its own or
neither.
1.
COPY --from=ghcr.io/astral-sh/uv:latest->:0.12.3COPY --from=on line 16 names an external image rather than an earlier stage, so:latestleaves the tool that builds the wheel floating: a build today and a build nextmonth can use different uv versions, and nothing in the tree records which one produced a
given image.
That's the same class of thing you already pin everywhere else — dependabot keeps
actions/checkout,actions/setup-pythonandgithub/codeql-actionon exact versionsfor you. This is the one build input it can't see, because dependabot doesn't read
COPY --from. So pinning it does mean carrying the bump by hand. If you'd rather keep itfloating for that reason, just drop this commit — it's your build and I have no stake in
the answer.
2.
apt-get cleandoesn't remove the package indicesapt-get cleanempties/var/cache/apt/archives— the downloaded.debfiles. Thepackage indices that
apt-get updatefetched live in/var/lib/apt/listsand surviveit, so they ship in the final image. Adding
rm -rf /var/lib/apt/lists/*to the sameRUNfinishes what thecleanis already there to do.On the size, and I'd rather show the working than assert a number: I don't have a
Docker daemon on this machine, so this is not a
docker imagesdiff. It's derived fromthe index sizes Debian publishes in its own
Releasefile forbookworm main/binary-amd64:Packages(unpacked)Packages.gzPackages.xzThe official Debian images set
Acquire::GzipIndexes "true"(debuerreotype does thisdeliberately, precisely because Dockerfiles tend not to delete the lists), so apt keeps
the compressed form rather than unpacking to 47.74 MiB. The saving is therefore roughly
9–12 MB, not the ~48 MB you'd get if you quoted the unpacked figure. Modest, but it's
on every pull, and the fix is one clause.
Neither commit changes what's installed:
iproute2anddumb-initare installed beforethe
rm, and the# syntax=docker/dockerfile:1.4frontend is untouched.Both were found by a Dockerfile linter I maintain, run over public repositories — the
COPY --fromcase was a rule it was missing, which is how this ended up worth a patchrather than a note. The patch itself was prepared by an automated agent and re-checked
against
mainby hand before opening; saying so up front seems better than not. Happy toclose it if this isn't useful to you.