Skip to content

perf(computer): mount the lock's .debs and wheels into the RUNs that install them, keeping them out of the image - #532

Merged
earakely-scale merged 1 commit into
mainfrom
perf/composer-mount-lock-files
Nov 7, 2026
Merged

earakely-scale merged 1 commit into
mainfrom
perf/composer-mount-lock-files

Conversation

@earakely-scale

@earakely-scale earakely-scale commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Every composed computer image kept the lock's .debs and wheels in its layers, though nothing uses them after installing.

  • _dockerfile copied them in with COPY packages/... and removed them with rm -rf in the next RUN.
  • A later RUN's rm only 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:

  • The same packages install.
  • BuildKit was already required, by RUN --network=none.
  • Image history records a RUN without its flags (checked on Docker 29), so layers_in_image.written still matches the run-script RUNs, and _runs and _compare are 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

  • Unit: three exact-Dockerfile assertions updated. New: test_the_locks_debs_and_wheels_are_mounted_into_the_runs_that_install_them_never_copied_into_a_layer. All four fail on main.
  • Integration: computer_app_test::test_the_locks_debs_and_wheels_install_from_mounts_and_stay_in_no_layer_of_the_image.
    • It checks the image has no COPY packages/ layer, that apt and venv installs work, and that /tmp/agentenv-packages is gone.
    • It fails on main: 4 COPY packages/ layers and an empty /tmp/agentenv-packages.
    • It passes on an arm64 Linux host and on local Docker on macOS.
  • Real computer (KeePassXC, arm64):
    • On main, docker history shows COPY packages/apt at 19.5 MB, COPY wheels/driver at 49.7 MB and COPY wheels/apps-keepassxc at 10.2 MB.
    • With this change those layers are gone, and the install layers are the same size.
    • The probe still passes, and the compressed image drops from 362.9 MB to 284.2 MB.
  • Unit tier: the same 3 host-specific failures as main (cua driver ×2, Windows disk recipe).

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence 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.

  • Computer images install locked packages without keeping their archives.

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]
Loading

Reviews (1) · Last reviewed commit: "perf(computer): mount the lock's .debs a..." · Reviewed by Greptile

…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>
@earakely-scale
earakely-scale requested a review from a team as a code owner November 7, 2026 17:37
@earakely-scale
earakely-scale merged commit 41a8a52 into main Nov 7, 2026
34 checks passed
@earakely-scale
earakely-scale deleted the perf/composer-mount-lock-files branch November 7, 2026 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant