fix(docker): stop the image build re-installing into a partial workspace

pnpm 11 changed the default of verifyDepsBeforeRun to "install", so `pnpm run` now
resolves and installs before executing a script. Each builder stage already installs its
own filtered subset with a frozen lockfile two steps earlier, so that install is redundant
work at best.

At worst it is fatal. No builder stage carries the whole workspace: the server stage never
copies client/, so the re-install resolves against a workspace with no client, finds
nothing depending on @embedpdf, and rejects the workspace-level patches for it with
ERR_PNPM_UNUSED_PATCH. The image has not built since the pnpm 11 upgrade.

Turn the check off for both build steps rather than widen the patch allowance, because the
dependencies genuinely are already installed and correct at that point; verifying them
against a workspace that was deliberately narrowed can only produce a wrong answer.
This commit is contained in:
neon
2026-08-16 20:51:21 +00:00
parent 21b7eb1e18
commit 197f6b6b30
+8 -2
View File
@@ -16,7 +16,13 @@ RUN --mount=type=cache,id=pnpm,target=/root/.local/share/pnpm/store \
COPY packages/ ./packages/
COPY client/ ./client/
RUN pnpm --filter client run build-only
# pnpm 11 defaults verifyDepsBeforeRun to "install", so running a script
# re-installs first. Each stage installed its own filtered subset with a frozen
# lockfile two steps up, and no stage carries the whole workspace, so that
# re-install is both redundant and wrong: it resolves against a partial
# workspace. In the server stage it is fatal, because client/ is absent and the
# @embedpdf patches then look unused.
RUN pnpm --config.verify-deps-before-run=false --filter client run build-only
# Stage 2: Build server + create deploy bundle
FROM base AS server-builder
@@ -31,7 +37,7 @@ RUN --mount=type=cache,id=pnpm,target=/root/.local/share/pnpm/store \
COPY packages/ ./packages/
COPY server/ ./server/
RUN pnpm --filter server run build
RUN pnpm --config.verify-deps-before-run=false --filter server run build
# pnpm deploy prunes to prod deps; dist/ is gitignored so copy it in after.
RUN pnpm --config.allow-unused-patches=true --filter server deploy --prod --legacy /deploy