Skip to content

Slim docker image - #1604

Merged
henmedia merged 3 commits into
henmedia:mainfrom
LudaThomas:slim-docker-image
Nov 10, 2026
Merged

henmedia merged 3 commits into
henmedia:mainfrom
LudaThomas:slim-docker-image

Conversation

@LudaThomas

Copy link
Copy Markdown
Contributor

Summary

  • Shrinks the Docker image from about 570 MB to 113.5 MB compressed (amd64 and arm64), as discussed in Docker image: about 570 MB to about 110 MB? #1597
  • next.config.ts: output: "standalone" only when the Dockerfile sets LAYERLING_STANDALONE=true; npm start and the static export are unchanged.
  • docker/Dockerfile: the runner gets the traced server, .next/static and public, without the webpack cache, sharp, typescript, apps/web/src or the bundler's unused copy of the CAD kernel wasm. Final stage is alpine:3.24 with a stripped Node from node: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.wasm and /api/shared-projects before keeping the digest, so a broken image never gets the version tag or latest.
  • READMEs: the image runs node apps/web/server.js, not next start.

Testing

Notes

  • Ran the image on arm64 (Apple Silicon) and amd64 (Intel Mac): editor, OCCT kernel, thumbnails into an existing volume and the shared-projects folder all work; docker stop exits cleanly.
  • Checked the new step locally against an image with @next/env removed: it fails after 30 s with MODULE_NOT_FOUND and prints the container log.
  • Didn't run npm run typecheck / npm test; the only TypeScript change is the output option in next.config.ts, which next build type-checks.

LudaThomas and others added 3 commits November 10, 2026 06:33
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>
@henmedia
henmedia merged commit 449254e into henmedia:main Nov 10, 2026
11 checks passed
@henmedia

Copy link
Copy Markdown
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.

@LudaThomas
LudaThomas deleted the slim-docker-image branch November 10, 2026 18:56
henmedia added a commit that referenced this pull request Nov 10, 2026
…, editor profiles (#1601, #1602), the smaller Docker image (#1604, #1595), the split plane fitting the part (#1606), the edge-feature undo button (#1600), the orthographic drag (#1558)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@henmedia

Copy link
Copy Markdown
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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants