Repository navigation
perf(claude-code): cut 500 MB of waste and share layers across targets - #196
Merged
Merged
Conversation
- npm installs use a BuildKit cache mount (--cache /tmp/npm-cache), so the ~160 MB npm cache no longer ships in the image. - Delete agent-browser's six non-matching platform binaries (~95 MB); the global link targets agent-browser-linux-<arch> directly. - Drop gh's 25 MB HTTP cache left by the gh-stack install. - New `shared` stage (sudoers, Chromium, Claude Code) that both targets build FROM, so default and sandbox share 22 of 23 layers. Local amd64: 2.82 -> 2.32 GB on disk, 852 -> 633 MB download; the Claude Code layer re-pulled on each bump drops from 214 to 108 MB compressed.
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.
What
Trims ~500 MB of dead weight from the
claude-codeimages and makes the default and sandbox targets share their heavy layers. No tools are added or removed.Why
The image had grown to 2.82 GB on disk and an 812 MB download. About 280 MB of that was waste: download caches and binaries for other platforms. The Claude Code layer, which Renovate bumps almost daily, was 214 MB compressed, half of it the npm cache, so every bump cost consumers that much. Default and sandbox shared no heavy layers, so anyone using both downloaded Chromium and Claude Code twice.
Changes
npm install -guses--cache /tmp/npm-cacheon a BuildKit cache mount, so~/.npm/_cacache(~160 MB across the two installs) is no longer shipped.agent-browserlink targetsbin/agent-browser-linux-<arch>directly. 174 → 19 MB.rm -rf ~/.cache/ghaftergh extension install. That cache is gh's HTTP cache holding a 25 MB copy of the gh-stack download.sharedstage: sudoers, Chromium and Claude Code move into asharedstage that both targets buildFROM.defaultadds agent-browser andAGENT_BROWSER_EXECUTABLE_PATH;sandboxadds only the firewall packages. The two images now share 22 of 23 layers.docs/plans/2026-10-06-claude-code-image-size-roadmap.md. It holds the baseline measurements, this tier's results, and the next steps: stripping Chromium's unused LLVM/Mesa libraries, and splitting the browser out of the core image.Results (local amd64 build)
Notes
agent-browseropens and snapshots a page. Runtimenpxworks and creates a node-owned~/.npm. No~/.npm,/tmp/npm-cacheor~/.cache/ghis left in either image.