diff --git a/Dockerfile.sandbox b/Dockerfile.sandbox index fe2cc7e380b..8b50c7a6745 100644 --- a/Dockerfile.sandbox +++ b/Dockerfile.sandbox @@ -14,7 +14,7 @@ RUN --mount=type=cache,id=openclaw-sandbox-bookworm-apt-cache,target=/var/cache/ git \ jq \ python3 \ - ripgrep \ + ripgrep RUN useradd --create-home --shell /bin/bash sandbox USER sandbox diff --git a/Dockerfile.sandbox-common b/Dockerfile.sandbox-common index 930aec0aef5..39eaa3692b4 100644 --- a/Dockerfile.sandbox-common +++ b/Dockerfile.sandbox-common @@ -24,7 +24,7 @@ ENV PATH=${BUN_INSTALL_DIR}/bin:${BREW_INSTALL_DIR}/bin:${BREW_INSTALL_DIR}/sbin RUN --mount=type=cache,id=openclaw-sandbox-common-apt-cache,target=/var/cache/apt,sharing=locked \ --mount=type=cache,id=openclaw-sandbox-common-apt-lists,target=/var/lib/apt,sharing=locked \ apt-get update \ - && apt-get install -y --no-install-recommends ${PACKAGES} \ + && apt-get install -y --no-install-recommends ${PACKAGES} RUN if [ "${INSTALL_PNPM}" = "1" ]; then npm install -g pnpm; fi diff --git a/scripts/docker/cleanup-smoke/Dockerfile b/scripts/docker/cleanup-smoke/Dockerfile index 4519ff9a385..e67a4b1fe87 100644 --- a/scripts/docker/cleanup-smoke/Dockerfile +++ b/scripts/docker/cleanup-smoke/Dockerfile @@ -8,7 +8,7 @@ RUN --mount=type=cache,id=openclaw-cleanup-smoke-apt-cache,target=/var/cache/apt && apt-get install -y --no-install-recommends \ bash \ ca-certificates \ - git \ + git WORKDIR /repo COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ diff --git a/src/docker-build-cache.test.ts b/src/docker-build-cache.test.ts index 3935e1185d4..08ff562099f 100644 --- a/src/docker-build-cache.test.ts +++ b/src/docker-build-cache.test.ts @@ -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");