From 3e0ba73d1c78a77e15d287e9f83f06b10a0972e0 Mon Sep 17 00:00:00 2001 From: openhands Date: Mon, 7 Sep 2026 11:33:04 +0200 Subject: [PATCH] fix(docker): include pnpm-workspace and npmrc in builder context The committed lockfile records overrides from pnpm-workspace.yaml. With the narrower manifest COPY, pnpm install --frozen-lockfile ran without the workspace file and failed with ERR_PNPM_LOCKFILE_CONFIG_MISMATCH in CI. Copy package.json, pnpm-lock, pnpm-workspace and .npmrc together so the override config present in the lockfile is also supplied at install time. --- Dockerfile | 5 ++++- src/lib/docker-build-contract.test.ts | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 905cda2e..2d773a45 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,10 @@ ENV NEXT_TELEMETRY_DISABLED=1 # install only needs to exist as a bootstrap and follows the active major. RUN apk add --no-cache git \ && npm install -g pnpm@latest -COPY package.json pnpm-lock.yaml* ./ +# pnpm-workspace.yaml + .npmrc must be present too: the lockfile records the +# overrides from pnpm-workspace.yaml, and --frozen-lockfile rejects a build +# where the workspace config is absent (ERR_PNPM_LOCKFILE_CONFIG_MISMATCH). +COPY package.json pnpm-lock.yaml* pnpm-workspace.yaml* .npmrc* ./ # pnpm fetch: download all deps into $PNPM_STORE first, so only the lockfile # change (not source changes) invalidates the network-heavy download layer. RUN pnpm fetch --ignore-scripts diff --git a/src/lib/docker-build-contract.test.ts b/src/lib/docker-build-contract.test.ts index 9a5d304d..03c6d20e 100644 --- a/src/lib/docker-build-contract.test.ts +++ b/src/lib/docker-build-contract.test.ts @@ -6,7 +6,7 @@ const dockerfile = readFileSync("Dockerfile", "utf8"); describe("Docker build cache", () => { it("installs frozen dependencies before copying application source", () => { const manifests = dockerfile.indexOf( - "COPY package.json pnpm-lock.yaml* ./", + "COPY package.json pnpm-lock.yaml* pnpm-workspace.yaml* .npmrc* ./", ); const fetch = dockerfile.indexOf("pnpm fetch --ignore-scripts"); const install = dockerfile.indexOf("pnpm install --frozen-lockfile");