Repository navigation
perf(computer): mount the lock's .debs and wheels into the RUNs that install them, keeping them out of the image - #532
Merged
Conversation
…install them, keeping them out of the image A computer image copied the lock's .debs and each layer's wheels in with COPY and removed them in the next RUN, so every one stayed in a layer: about 80 MB in a KeePassXC image. They are now bind-mounted, read-only, into the RUN that installs them. Image history records RUNs without their flags, so matching an image's layers to its run scripts is unchanged. Composed images re-key once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6 of 22 tasks
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.
Summary
Every composed computer image kept the lock's
.debs and wheels in its layers, though nothing uses them after installing._dockerfilecopied them in withCOPY packages/...and removed them withrm -rfin the nextRUN.rmonly hides a file, so the copy stayed in its layer.They are now bind-mounted, read-only, into the RUN that installs them:
RUN --network=none --mount=type=bind,source=packages/...,target=/tmp/agentenv-packages/... apt-get install …(and the same for each layer's wheels).Nothing else changes:
RUN --network=none.layers_in_image.writtenstill matches the run-script RUNs, and_runsand_compareare untouched. The unit tests' fake image now strips RUN flags as BuildKit does.This re-keys every composed computer image once: each rebuilds the first time it's used after upgrading.
Downloads (
Download) still stay in their layer. That's a separate, opt-in change to the protocol (Download(keep=False)).Test plan
test_the_locks_debs_and_wheels_are_mounted_into_the_runs_that_install_them_never_copied_into_a_layer. All four fail onmain.computer_app_test::test_the_locks_debs_and_wheels_install_from_mounts_and_stay_in_no_layer_of_the_image.COPY packages/layer, that apt and venv installs work, and that/tmp/agentenv-packagesis gone.main: 4COPY packages/layers and an empty/tmp/agentenv-packages.main,docker historyshowsCOPY packages/aptat 19.5 MB,COPY wheels/driverat 49.7 MB andCOPY wheels/apps-keepassxcat 10.2 MB.main(cua driver ×2, Windows disk recipe).🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge; no actionable issues were found.Summary
Replaces package archive copies with read-only mounts during installation, keeping those copies out of composed image layers.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR A[Locked package archives] --> B[Build context] B --> C[Read-only mount during install] C --> D[Installed packages in image] C --> E[Archive mount discarded]Reviews (1) · Last reviewed commit: "perf(computer): mount the lock's .debs a..." · Reviewed by Greptile