Docker: fix sandbox cache mount continuations

This commit is contained in:
Vincent Koc
2026-03-08 16:31:21 -07:00
parent 8b56fffc64
commit fcfa6373bf
4 changed files with 29 additions and 3 deletions

View File

@@ -56,6 +56,32 @@ describe("docker build cache layout", () => {
}
});
it("does not leave empty shell continuation lines in sandbox-common", async () => {
const dockerfile = await readRepoFile("Dockerfile.sandbox-common");
expect(dockerfile).not.toContain("apt-get install -y --no-install-recommends ${PACKAGES} \\");
expect(dockerfile).toContain(
'RUN if [ "${INSTALL_PNPM}" = "1" ]; then npm install -g pnpm; fi',
);
});
it("does not leave blank lines after shell continuation markers", async () => {
for (const path of [
"Dockerfile.sandbox",
"Dockerfile.sandbox-browser",
"Dockerfile.sandbox-common",
"scripts/docker/cleanup-smoke/Dockerfile",
"scripts/docker/install-sh-smoke/Dockerfile",
"scripts/docker/install-sh-e2e/Dockerfile",
"scripts/docker/install-sh-nonroot/Dockerfile",
]) {
const dockerfile = await readRepoFile(path);
expect(
dockerfile,
`${path} should not have blank lines after a trailing backslash`,
).not.toMatch(/\\\n\s*\n/);
}
});
it("copies only install inputs before pnpm install in the e2e image", async () => {
const dockerfile = await readRepoFile("scripts/e2e/Dockerfile");
const installIndex = dockerfile.indexOf("pnpm install --frozen-lockfile");