build(images): clean npm cache in client layers #72
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "build/npm-cache"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
Each client runs from an image built from
containers/Dockerfile: ashared base, then one layer that installs the client. The Codex and
OpenCode layers install with
npm install -g, which leaves thetarballs it downloaded in
~/.npm. Every host that installs orlaunches those clients stored them in the image for nothing, since no
launch reads that cache. The base already removes it after installing
Prettier; the client layers did not.
What changed
Before, the
codexandopencodeimages held npm's download cache.Now each removes it in the same
RUNthat installs the client, so thelayer never stores it. The
claudetarget installs without npm andstays as it was.
The change is two lines of
containers/Dockerfileand an assertion intests/unit/test_containerfile.shthat the clean follows the installin its layer. An installed host takes it at its next
./install.shrun, since a launch rebuilds from the installed release's Dockerfile.
How to verify
Have Git and Bash 4.4 or newer.
On
masterthe two install lines, 88 and 141, end theirRUN. Aftergit switch build/npm-cacheeach continues into&& npm cache clean --force, andbash tests/unit/test_containerfile.shprints
20 test(s), 0 failure(s).Checks run on the tip:
make lint && .agents/hooks/shellcheck.sh repo && make testpasses, 352 tests; the two extended stage tests fail on
master'sDockerfile. Not tried, for want of rootless Podman where the change was
made: a real build. To see the size, run
./install.sh --build codexon each branch and compare
podman image inspect --format '{{.Size}}' codex-cli:latest; the gatemake test-e2ebuilds every target.0234fdadc1tocad0aace6ePull request closed