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:
Vincent Koc
2026-03-08 16:07:04 -07:00
committed by GitHub
parent bd1fe4d8b4
commit 3f3f66a5f7
10 changed files with 56 additions and 34 deletions

View File

@@ -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',
);
});
});