mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-04 09:50:23 +00:00
Docker: trim runtime image payload (#40307)
* Docker: shrink runtime image payload * Docker: add runtime pnpm opt-in * Docker: collapse helper entrypoint chmod layers * Docker: restore bundled pnpm runtime * Update CHANGELOG.md
This commit is contained in:
@@ -37,6 +37,15 @@ describe("Dockerfile", () => {
|
||||
expect(dockerfile).toContain("apt-get install -y --no-install-recommends xvfb");
|
||||
});
|
||||
|
||||
it("prunes runtime dependencies after the build stage", async () => {
|
||||
const dockerfile = await readFile(dockerfilePath, "utf8");
|
||||
expect(dockerfile).toContain("FROM build AS runtime-assets");
|
||||
expect(dockerfile).toContain("CI=true pnpm prune --prod");
|
||||
expect(dockerfile).toContain(
|
||||
"COPY --from=runtime-assets --chown=node:node /app/node_modules ./node_modules",
|
||||
);
|
||||
});
|
||||
|
||||
it("normalizes plugin and agent paths permissions in image layers", async () => {
|
||||
const dockerfile = await readFile(dockerfilePath, "utf8");
|
||||
expect(dockerfile).toContain("for dir in /app/extensions /app/.agent /app/.agents");
|
||||
@@ -49,4 +58,12 @@ describe("Dockerfile", () => {
|
||||
expect(dockerfile).toContain('== "fpr" {');
|
||||
expect(dockerfile).not.toContain('\\"fpr\\"');
|
||||
});
|
||||
|
||||
it("keeps runtime pnpm available", async () => {
|
||||
const dockerfile = await readFile(dockerfilePath, "utf8");
|
||||
expect(dockerfile).toContain("ENV COREPACK_HOME=/usr/local/share/corepack");
|
||||
expect(dockerfile).toContain(
|
||||
'corepack prepare "$(node -p "require(\'./package.json\').packageManager")" --activate',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user