build(docker): move image to node 24 and install pnpm without corepack

Supersedes #1250. Dependabot's 22 -> 26 bump fails the image build with
`corepack enable` exiting 127: Node 25 unbundled Corepack, so it is simply not
in the base image any more.

Two changes instead:

- both stages move to `node:24-alpine`, the current LTS line. Node 26 is still
  Current until October 2026, so it is the wrong target for a self-hosted
  runtime image.
- pnpm is installed globally at the exact `packageManager` version instead of
  through Corepack, which keeps the install reproducible and stops the next
  base-image major from breaking the build the same way.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
4grayandClaude Opus 5 committed 2026-07-26 02:27:14 +02:00
1 parent 7e8c2ccce1
commit 28569e05b7
2 files changed
+12 -4

No files matched your search

+8 -3
View File
@@ -1,7 +1,7 @@
# The Nx builds below emit platform-independent JS/static assets. During
# multi-arch publish builds, keep that heavy build stage on the native builder
# platform instead of running Node/Nx through QEMU for linux/arm64.
FROM --platform=$BUILDPLATFORM node:22-alpine AS build
FROM --platform=$BUILDPLATFORM node:24-alpine AS build
RUN apk add --no-cache python3 make g++ git
@@ -11,7 +11,12 @@ COPY .npmrc ./
COPY package.json pnpm-lock.yaml ./
COPY patches ./patches
RUN corepack enable && pnpm install --frozen-lockfile --ignore-scripts
# Node 25 unbundled Corepack, so `corepack enable` cannot be the way pnpm gets
# installed here — it would break on the next base-image major. Install the
# exact pnpm from `packageManager` instead, which stays reproducible.
RUN PNPM_VERSION="$(node -p 'require("./package.json").packageManager.split("@")[1].split("+")[0]')" \
&& npm install --global "pnpm@${PNPM_VERSION}" \
&& pnpm install --frozen-lockfile --ignore-scripts
COPY . .
@@ -23,7 +28,7 @@ RUN node tools/build/inject-build-commit.mjs
RUN pnpm nx build web --configuration=pwa
RUN pnpm nx build web-backend
FROM node:22-alpine
FROM node:24-alpine
RUN apk add --no-cache gettext nginx
+4 -1
View File
@@ -175,7 +175,10 @@ browser sidecar data.
The Docker image has two stages:
1. Build stage installs dependencies and runs `web:pwa` plus `web-backend`.
2. Runtime stage uses `node:22-alpine` with nginx installed. nginx serves
pnpm is installed globally at the exact `packageManager` version rather than
through Corepack, which Node 25 unbundled, so the base-image major stays
free to move.
2. Runtime stage uses `node:24-alpine` with nginx installed. nginx serves
`dist/apps/web` and proxies `/api/*` to the local Express backend.
The entrypoint renders the nginx config from a `${PORT}` template, starts the
backend, waits for `/health`, and then starts nginx. If either process exits