mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-21 10:16:44 +00:00
fix(docker): keep prune store warmup before offline stage
This commit is contained in:
+2
-2
@@ -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 \
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user