Repository navigation
Conversation
…slim them CLI_VERSION was declared at the top of the Dockerfile. Every RUN after an ARG is cache-keyed on its value, and CLI_VERSION changes on every release, so each release rebuilt every toolchain layer even when nothing in them changed. Between 2.11.10 and 2.11.11, 1,028 MB of the 1,049 MB compressed amd64 image was new layers, so every upgrade was close to a full pull. The release ARGs are now declared just before the CLI install, and a unit test keeps them there. The image also drops payload nothing runs: - rustup's minimal profile replaces the default one, which added offline HTML docs, rustfmt and clippy. Reachability runs only cargo. - npm and pip caches are no longer left in the image. - strace is no longer installed. - A .dockerignore keeps tests and other repo files out of the build context. dist/ stays in, since Dockerfile.preview copies the preview wheel from it.
This was referenced Nov 4, 2026
Contributor
Author
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 29a60c9. Configure here.
This branch was successfully deployed
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.
Every release currently rebuilds every layer of the Docker image, so upgrading
socketdev/clidownloads nearly the whole image. This PR fixes that and removes about 1.1 GB of payload nothing runs.Root cause of the per-release re-pull
ARG CLI_VERSION(with the other release ARGs) was declared at the top of the Dockerfile. BuildKit cache-keys everyRUNafter anARGon that ARG's value, andCLI_VERSIONchanges on every release, so every toolchain layer missed the cache on every release build even when nothing in it changed. From the published amd64 manifests:The base image digest was the same across 2.11.10 → 2.11.11, so the churn didn't come from upstream. The release ARGs are now declared just before the CLI install.
tests/unit/test_dockerfile.pyfails if one is declared above a toolchain layer again; it fails againstmain's Dockerfile.Dockerfileis added to the Unit Testspushpaths, since the suite now reads it.Payload removed
minimalprofile (rustc,cargo,rust-std) instead ofdefault. Drops about 900 MB of offline HTML docs, plusrustfmtandclippy. Reachability only invokescargo.npm cache clean --forceafter the global install, andpip install --no-cache-dirthroughout.apk updateis gone;apk add --no-cachedoesn't need it.straceis no longer installed (it was referenced nowhere). The changelog notesapk add stracefor anyone who relied on it..dockerignore: keepstests/and other repo files out of the context and/app.dist/stays in, becauseDockerfile.previewcopies the preview wheel from it.Verification
Local
linux/arm64builds; the PR preview image is built fromDockerfile.preview, so it doesn't exercise these changes.socketdev/cli:2.11.11vs 3,446 MB for this branch (uncompressed, arm64)./root/.rustupwent from 1,693 to 753 MB,/root/.npmfrom 20 to 1 MB,/appfrom 11 to 2 MB.CLI_VERSION=2.11.10, then rebuilt withCLI_VERSION=2.11.11. Steps 2–17, everything through the locked dependency install, wereCACHED. Only the CLI install and the small layers after it rebuilt. A real release also changespyproject.toml/uv.lock, which adds the locked-dependency layer (about 21 MB). So an upgrade is roughly 25 MB uncompressed instead of about 1 GB compressed.socketcli,cargo/rustc,go,java,dotnet,node,ruby/bundle,pyenv,uvandsocketall run.cargo generate-lockfile,cargo metadataandcargo buildwork on a crate with a crates.io dependency.Not verified here: an end-to-end Rust reachability run in the image.
e2e-test.ymlruns reachability on the runner, not in the image, and only against an npm fixture. I'd appreciate a quick Rust--reachrun in a build of this branch from someone with a token, to confirm nothing beyondcargois needed.Once released, the GitHub Actions cache (currently around its 10 GB limit) should stop growing by about a full image per release, since unchanged layers are no longer re-exported.
Bumps to
2.11.12. #438 also targets2.11.12; whichever merges second rides that version and only needs the changelog merged.Ref: CE-430
🤖 Generated with Claude Code
Note
Medium Risk
Changes the default Docker toolchain (minimal Rust, no strace) and layer layout that all CLI container users depend on; Rust reachability in the image was not fully re-verified in this PR.
Overview
Release 2.11.12 reshapes how the published
socketdev/cliimage is built so version bumps reuse cached toolchain layers instead of forcing a near-full re-download, and trims roughly a gigabyte of unused payload.Layer caching:
CLI_VERSIONand the other release-specific build args move to just before the CLI install step. BuildKit invalidates every subsequentRUNwhen those args change; having them at the top previously busted cache for Go, Java, Rust, pyenv, locked deps, etc. on every release. A new unit test intest_dockerfile.pyasserts release ARGs stay below toolchain installs, andDockerfileis included in the CI paths filter on push.Smaller image: Rust is installed with rustup’s minimal profile (no offline docs,
rustfmt, orclippy);straceis dropped from the base packages; npm and pip caches are cleared or use--no-cache-dir; redundantapk updateis removed. A new.dockerignorekeeps tests, docs, and similar out of the build context while still allowing preview wheels fromdist/.Reviewed by Cursor Bugbot for commit 29a60c9. Configure here.