diff --git a/Dockerfile b/Dockerfile index 9e8b99afeccf..c4b754ac68ef 100644 --- a/Dockerfile +++ b/Dockerfile @@ -72,7 +72,8 @@ RUN --mount=type=cache,id=openclaw-pnpm-store,target=/root/.local/share/pnpm/sto NODE_OPTIONS=--max-old-space-size=2048 pnpm install --frozen-lockfile \ --config.supportedArchitectures.os=linux \ --config.supportedArchitectures.cpu="$(node -p 'process.arch')" \ - --config.supportedArchitectures.libc=glibc + --config.supportedArchitectures.libc=glibc && \ + pnpm store add source-map@0.6.1 # pnpm v10+ may append peer-resolution hashes to virtual-store folder names; do not hardcode `.pnpm/...` # paths. Matrix's native downloader can hit transient release CDN errors while @@ -122,7 +123,6 @@ FROM build AS runtime-assets ARG OPENCLAW_EXTENSIONS ARG OPENCLAW_BUNDLED_PLUGIN_DIR RUN --mount=type=cache,id=openclaw-pnpm-store,target=/root/.local/share/pnpm/store,sharing=locked \ - pnpm store add source-map@0.6.1 && \ CI=true pnpm prune --prod \ --config.offline=true \ --config.supportedArchitectures.os=linux \ diff --git a/src/dockerfile.test.ts b/src/dockerfile.test.ts index 0ccd56a13e82..3f86b46e17ac 100644 --- a/src/dockerfile.test.ts +++ b/src/dockerfile.test.ts @@ -91,10 +91,14 @@ describe("Dockerfile", () => { it("uses the Docker target platform for pnpm install and prune", async () => { const dockerfile = await readFile(dockerfilePath, "utf8"); + const installIndex = dockerfile.indexOf("pnpm install --frozen-lockfile \\"); + const storeAddIndex = dockerfile.indexOf("pnpm store add source-map@0.6.1"); + const pruneIndex = dockerfile.indexOf("CI=true pnpm prune --prod \\"); - expect(dockerfile).toContain("pnpm install --frozen-lockfile \\"); - expect(dockerfile).toContain("pnpm store add source-map@0.6.1 && \\"); - expect(dockerfile).toContain("CI=true pnpm prune --prod \\"); + expect(installIndex).toBeGreaterThan(-1); + expect(storeAddIndex).toBeGreaterThan(installIndex); + expect(storeAddIndex).toBeLessThan(pruneIndex); + expect(pruneIndex).toBeGreaterThan(-1); expect(dockerfile).toContain("--config.offline=true"); expect(dockerfile.split("--config.supportedArchitectures.os=linux").length - 1).toBe(2); expect(