fix(docker): copy postinstall helper imports

This commit is contained in:
Peter Steinberger
2026-04-29 05:25:18 +01:00
parent 203213028e
commit aa84b738b6
2 changed files with 15 additions and 0 deletions

View File

@@ -63,6 +63,7 @@ COPY openclaw.mjs ./
COPY ui/package.json ./ui/package.json
COPY patches ./patches
COPY scripts/postinstall-bundled-plugins.mjs scripts/preinstall-package-manager-warning.mjs scripts/npm-runner.mjs scripts/windows-cmd-helpers.mjs ./scripts/
COPY scripts/lib/package-dist-imports.mjs ./scripts/lib/package-dist-imports.mjs
COPY --from=ext-deps /out/ ./${OPENCLAW_BUNDLED_PLUGIN_DIR}/

View File

@@ -74,6 +74,20 @@ describe("Dockerfile", () => {
);
});
it("copies postinstall helper imports before pnpm install", async () => {
const dockerfile = await readFile(dockerfilePath, "utf8");
const installIndex = dockerfile.indexOf("pnpm install --frozen-lockfile");
const postinstallIndex = dockerfile.indexOf("COPY scripts/postinstall-bundled-plugins.mjs");
const distImportHelperIndex = dockerfile.indexOf(
"COPY scripts/lib/package-dist-imports.mjs ./scripts/lib/package-dist-imports.mjs",
);
expect(postinstallIndex).toBeGreaterThan(-1);
expect(distImportHelperIndex).toBeGreaterThan(-1);
expect(postinstallIndex).toBeLessThan(installIndex);
expect(distImportHelperIndex).toBeLessThan(installIndex);
});
it("prunes runtime dependencies after the build stage", async () => {
const dockerfile = await readFile(dockerfilePath, "utf8");
expect(dockerfile).toContain("FROM build AS runtime-assets");