Repository navigation
Docker image: about 570 MB to about 110 MB? #1597
LudaThomas
started this conversation in
Ideas
Replies: 1 comment
|
@LudaThomas Thanks for digging into this, the numbers match what I see in the Dockerfile: the whole One wish, because the removal list is kept by hand: could the Docker workflow start the freshly built image and fetch the start page and the OCCT wasm before it tags |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
The ready-made image
ghcr.io/henmedia/layerling:1.147.0is about 570 MB compressed per platform (amd64 569.7 MB, arm64 566.5 MB). On a NAS or a slow connection that makes every update a long pull, so I looked at where the size comes from, and I have a branch that brings it to about 110 MB. Before opening a pull request I'd like to know whether you'd want it, and in what form.Where the size comes from
From the layers of 1.147.0 (amd64, compressed):
COPY .next.next/cache/webpack, the build cache, which the server never readsnpm ci --omit=devnext startdoesn't usenode:24-bookworm-slimwith npm and yarnpublicWhat the branch does
Branch: https://github.com/LudaThomas/layerling/tree/slim-docker-image (one commit:
docker/Dockerfileandapps/web/next.config.ts)output: "standalone"is set only when the Dockerfile setsLAYERLING_STANDALONE=true, sonpm startand the static export behave as before. The image then ships only the server files Next traced, plus.next/staticandpublic, with no build cache.sharp(the image optimizer is off in next.config.ts),typescript,apps/web/src, and the bundler's copy of the CAD kernel wasm under_next/static/media. Every loader asks for/occt/<version>/, andgenerate-service-worker.mjsalready skips that copy.alpine:3.24with a stripped Node binary fromnode:24-alpine3.24, with no npm, yarn or Debian. It still has a shell, sodocker exec, NAS consoles and theprintenvchecks in the guides keep working.pinggroup is removed to free that id), and thumbnails still land in/app/.codex/project-thumbnails, where the documented volume is mounted. The standalone server changes intoapps/web, so a link fromapps/web/.codexleads back there.Result: about 111 MB compressed (arm64) and 301 MB on disk.
Tested on arm64:
docker stopexits cleanly.amd64 and arm64 built and published from my fork (https://github.com/LudaThomas/layerling/actions/runs/42836119181), 113.5 MB compressed on both. Tested on arm64 (Apple Silicon) and amd64 (Intel Mac). Try it with
docker pull ghcr.io/ludathomas/layerling:1.156.3-slim.Trade-offs to be aware of
next start. It runsnode apps/web/server.js(still production mode), so the README line saying "The image runsnext start" would need a small wording change.Smaller options
If the full change is more than you want:
&& rm -rf apps/web/.next/cacheto the build step. That's one line with no other behaviour change, and should bring it to roughly 275 MB (estimated from the layers, not built).Would you take a pull request for this, and which version would you prefer?
All reactions