build(docker): slim down the runtime image
- install production dependencies and chromium in a separate stage - drop source maps, typescript sources and declarations, docs, typeorm's browser build, better-sqlite3's c sources and ffmpeg - base the runtime on debian:bookworm-slim with only the node binary - document the image layout - bump version to 1.22.1
This commit is contained in:
1 parent
355dbb0024
commit
8d8aed7b87
5 files changed
+48
-10
No files matched your search
@@ -204,6 +204,8 @@ The root `Dockerfile` builds a single image with the whole application: it build
|
||||
|
||||
The runtime image uses Playwright's headless-only Chromium build (`chromium-headless-shell`) with just the shared libraries it links against, plus DejaVu and Liberation fonts (Liberation is metric-compatible with Arial/Times, so pages lay out as they would with those fonts). All browser launches are headless, so the full desktop Chromium isn't installed. If a new Playwright version needs another library, `ldd` on the `chrome-headless-shell` binary in the image lists what's missing.
|
||||
|
||||
To keep the image small, production dependencies and the browser are installed in a separate `runtime-deps` stage, which drops what nothing loads at runtime (source maps, TypeScript sources and declarations, docs, TypeORM's browser build, better-sqlite3's C sources, and Playwright's ffmpeg, which is only used for video recording). The runtime stage is plain `debian:bookworm-slim` with only the `node` binary copied in, so the image has no `npm`, `npx`, `yarn` or `corepack`. If a package starts failing in the image only, check whether it reads one of the deleted file types at runtime.
|
||||
|
||||
```bash
|
||||
docker compose build
|
||||
```
|
||||
|
||||
Reference in new issue
Block a user