Skip to content

Commit aa84b73

Browse files
committed
fix(docker): copy postinstall helper imports
1 parent 2032130 commit aa84b73

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ COPY openclaw.mjs ./
6363
COPY ui/package.json ./ui/package.json
6464
COPY patches ./patches
6565
COPY scripts/postinstall-bundled-plugins.mjs scripts/preinstall-package-manager-warning.mjs scripts/npm-runner.mjs scripts/windows-cmd-helpers.mjs ./scripts/
66+
COPY scripts/lib/package-dist-imports.mjs ./scripts/lib/package-dist-imports.mjs
6667

6768
COPY --from=ext-deps /out/ ./${OPENCLAW_BUNDLED_PLUGIN_DIR}/
6869

src/dockerfile.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,20 @@ describe("Dockerfile", () => {
7474
);
7575
});
7676

77+
it("copies postinstall helper imports before pnpm install", async () => {
78+
const dockerfile = await readFile(dockerfilePath, "utf8");
79+
const installIndex = dockerfile.indexOf("pnpm install --frozen-lockfile");
80+
const postinstallIndex = dockerfile.indexOf("COPY scripts/postinstall-bundled-plugins.mjs");
81+
const distImportHelperIndex = dockerfile.indexOf(
82+
"COPY scripts/lib/package-dist-imports.mjs ./scripts/lib/package-dist-imports.mjs",
83+
);
84+
85+
expect(postinstallIndex).toBeGreaterThan(-1);
86+
expect(distImportHelperIndex).toBeGreaterThan(-1);
87+
expect(postinstallIndex).toBeLessThan(installIndex);
88+
expect(distImportHelperIndex).toBeLessThan(installIndex);
89+
});
90+
7791
it("prunes runtime dependencies after the build stage", async () => {
7892
const dockerfile = await readFile(dockerfilePath, "utf8");
7993
expect(dockerfile).toContain("FROM build AS runtime-assets");

0 commit comments

Comments
 (0)