diff --git a/src/lib/docker-build-contract.test.ts b/src/lib/docker-build-contract.test.ts index db8d718d81..9a5d304d56 100644 --- a/src/lib/docker-build-contract.test.ts +++ b/src/lib/docker-build-contract.test.ts @@ -6,18 +6,21 @@ const dockerfile = readFileSync("Dockerfile", "utf8"); describe("Docker build cache", () => { it("installs frozen dependencies before copying application source", () => { const manifests = dockerfile.indexOf( - "COPY package.json *lock* pnpm-workspace.yaml .npmrc ./", + "COPY package.json pnpm-lock.yaml* ./", ); + const fetch = dockerfile.indexOf("pnpm fetch --ignore-scripts"); const install = dockerfile.indexOf("pnpm install --frozen-lockfile"); const source = dockerfile.indexOf("COPY . ."); expect(manifests).toBeGreaterThan(-1); - expect(install).toBeGreaterThan(manifests); + expect(fetch).toBeGreaterThan(manifests); + expect(install).toBeGreaterThan(fetch); expect(source).toBeGreaterThan(install); }); - it("retains the package store and Next compiler cache across source changes", () => { - expect(dockerfile).toContain("id=epicnext-pnpm,target=/pnpm/store"); - expect(dockerfile).toContain("--store-dir=/pnpm/store"); - expect(dockerfile).toContain("id=epicnext-next,target=/app/.next/cache"); + it("keeps dependency downloads in a lockfile-only cached layer", () => { + expect(dockerfile).toContain("pnpm fetch --ignore-scripts"); + expect(dockerfile).toContain( + "pnpm install --frozen-lockfile --ignore-scripts --offline", + ); }); it("ships standalone output without a redundant dependency pruning step", () => { expect(dockerfile).toContain("/app/.next/standalone ./");