From ebcc320e03d060f512edec8237439d683c5a4fcf Mon Sep 17 00:00:00 2001 From: Jascha Date: Fri, 29 May 2026 22:04:38 -0700 Subject: [PATCH] fix(docker): build on Node 20 LTS so the image compiles again MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 /. --- Dockerfile | 12 +++++++----- package.json | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index d3f0fd0b..df51a8cf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ ## # Build project -FROM node:16.13-alpine3.13 AS builder +FROM node:20-alpine AS builder RUN set -x \ # Change node uid/gid @@ -36,12 +36,14 @@ RUN set -x \ && npm config set fetch-retry-mintimeout 20000 \ && npm config set fetch-retry-maxtimeout 120000 \ && npm config set fetch-timeout 600000 \ - # Build - && PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true npm ci \ + # Build. --legacy-peer-deps: the lockfile is resolved that way + # (e.g. raw-loader@3 peer-requires webpack 4 while we run webpack 5); + # npm 10's strict ci peer enforcement otherwise rejects it. + && PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true npm ci --legacy-peer-deps \ && npm run build # Main image -FROM node:16.13-alpine3.13 +FROM node:20-alpine RUN set -x \ # Change node uid/gid @@ -74,7 +76,7 @@ RUN set -x \ && npm config set fetch-retry-mintimeout 20000 \ && npm config set fetch-retry-maxtimeout 120000 \ && npm config set fetch-timeout 600000 \ - && npm ci --production \ + && npm ci --omit=dev --legacy-peer-deps \ && npm cache clean --force RUN mkdir -p /app/.config/configstore RUN ln -s dist/version.json version.json diff --git a/package.json b/package.json index 58900da4..f6989d72 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "cache": true }, "engines": { - "node": "^16.13.0" + "node": ">=20.9.0" }, "devDependencies": { "@babel/core": "^7.17.9",