Repository navigation
Slim docker image - #1604
Merged
Merged
Slim docker image#1604
Conversation
The runner copied all of apps/web/.next, including the webpack build cache (about 294 MB of the 570 MB compressed image), and installed every production dependency, the 143 MB native Next compiler among them. - next.config.ts builds with output: "standalone" when the Dockerfile sets LAYERLING_STANDALONE=true; builds by hand still work with `next start`. - The runner gets the traced server, .next/static and public, without sharp (image optimizer is off), typescript, apps/web/src and the bundler's unused copy of the CAD kernel wasm. - The final stage is alpine with a stripped Node binary from the node image on the same Alpine release: no npm, yarn or Debian, but still a shell, so docker exec and NAS consoles keep working. - The user stays 999:999 (Alpine's ping group is removed for it), and a link from apps/web/.codex keeps thumbnails in /app/.codex/project- thumbnails, where existing volumes are mounted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tart command The Dockerfile removes packages the tracer picked up but the server should not need. If a later Next version needs one of them after all, the build still succeeds and the image only breaks once someone runs it. Each build job now starts the image it just pushed, by digest, and fetches the start page, the CAD kernel wasm under /occt/<version>/ and /api/shared-projects (the start page is prerendered, so the route is what runs server code). If any of them fails within 30 s the job prints the container log and stops before keeping the digest, so the publish job neither tags the version nor moves latest. The READMEs said the image runs `next start`; it runs `node apps/web/server.js` now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
|
@LudaThomas thank you, this is just what we talked about: the standalone output only for Docker, the removal list, Alpine, and the check that starts the image before it gets the version tag. 570 MB down to about 113 MB will be noticed by everyone who pulls it on a NAS. I have merged it, and it comes with the next release. |
Owner
|
@LudaThomas the slim image is out with layerling 1.156.4. The Docker build for it is running now, so GHCR and Docker Hub get the smaller image in a few minutes. Thanks again! |
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.
Summary
next.config.ts:output: "standalone"only when the Dockerfile setsLAYERLING_STANDALONE=true;npm startand the static export are unchanged.docker/Dockerfile: the runner gets the traced server,.next/staticandpublic, without the webpack cache,sharp,typescript,apps/web/srcor the bundler's unused copy of the CAD kernel wasm. Final stage isalpine:3.24with a stripped Node fromnode:24-alpine3.24(no npm/yarn), still with a shell. User stays 999:999; thumbnails stay in/app/.codex/project-thumbnails.docker.yml: each build job starts the image it just pushed and fetches/,/occt/<version>/occt-wasm.wasmand/api/shared-projectsbefore keeping the digest, so a broken image never gets the version tag orlatest.node apps/web/server.js, notnext start.Testing
npm run typechecknpm testNotes
docker stopexits cleanly.@next/envremoved: it fails after 30 s withMODULE_NOT_FOUNDand prints the container log.npm run typecheck/npm test; the only TypeScript change is theoutputoption innext.config.ts, whichnext buildtype-checks.