Skip to content

fix(docker): build on Node 20 LTS so the image compiles again#34

Merged
jaschadub merged 1 commit into
masterfrom
fix/docker-node-20
May 30, 2026
Merged

fix(docker): build on Node 20 LTS so the image compiles again#34
jaschadub merged 1 commit into
masterfrom
fix/docker-node-20

Conversation

@jaschadub
Copy link
Copy Markdown
Member

Summary

The Docker CI build has been red since #31 (Build (linux/amd64) and Build (linux/arm64) both fail). This PR makes it green again.

Root cause

The Dockerfile pinned node:16.13-alpine3.13 for both stages, but the webpack-5 toolchain now requires Node 20+:

Fix

  • Bump both builder + runtime stages to node:20-alpine. The app has been running and tested on Node 20.19/20.20 throughout development of chore(build): upgrade to webpack 5 #30fix(test): repair frontend test suite under webpack 5 #33, so Node 20 is already proven for both build and runtime.
  • Add --legacy-peer-deps to both npm ci calls. Node 20 ships npm 10, whose npm ci strictly enforces peer deps and rejects the lockfile (raw-loader@3 peer-requires webpack 4 while we run webpack 5). The lockfile is resolved with --legacy-peer-deps everywhere else; this matches it. Also switched the deprecated --production to --omit=dev.
  • engines.node>=20.9.0 to reflect the real floor.

Why not downgrade copy-webpack-plugin instead?

It was bumped to 14 in #31 specifically to drop the vulnerable serialize-javascript. The base image had to move off the EOL Node 16 regardless (even copy-webpack-plugin@12 needs Node ≥18.12), so moving to the Node 20 LTS we already test on is the cleaner direction.

Test plan

  • docker build --platform linux/amd64 . — completes both stages, image exported
  • Built image boots (node v20.20.2) and serves HTTP 200 on /
  • npm test green (pre-push hook ran on push, no --no-verify)

This is the last piece of the webpack-5 series (#30 build → #33 tests → this, the Docker image). Merging it returns Docker CI to green on master.

The Docker CI build has been red since #31. The webpack-5 toolchain now
needs Node 20+ — copy-webpack-plugin@14 calls Array.prototype.toSorted
(Node >=20.9), which threw under the pinned node:16.13 base during
`npm run build`.

- Bump both builder and runtime stages to node:20-alpine (the app has
  been running and tested on Node 20.19/20.20 throughout development).
- Node 20 ships npm 10, whose `npm ci` strictly enforces peer deps and
  rejects the lockfile (raw-loader@3 peer-requires webpack 4 while we
  run webpack 5). Add --legacy-peer-deps to both `npm ci` calls to match
  how the lockfile is resolved; switch the deprecated --production flag
  to --omit=dev.
- Update engines.node to >=20.9.0 to reflect the real floor.

Verified locally: `docker build` completes both stages; the resulting
image boots (node v20.20.2) and serves HTTP 200 on /.
@jaschadub jaschadub merged commit 5bebacc into master May 30, 2026
3 checks passed
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.

1 participant