Skip to content

Commit fcfa637

Browse files
committed
Docker: fix sandbox cache mount continuations
1 parent 8b56fff commit fcfa637

File tree

4 files changed

+29
-3
lines changed

4 files changed

+29
-3
lines changed

Dockerfile.sandbox

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ RUN --mount=type=cache,id=openclaw-sandbox-bookworm-apt-cache,target=/var/cache/
1414
git \
1515
jq \
1616
python3 \
17-
ripgrep \
17+
ripgrep
1818

1919
RUN useradd --create-home --shell /bin/bash sandbox
2020
USER sandbox

Dockerfile.sandbox-common

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ ENV PATH=${BUN_INSTALL_DIR}/bin:${BREW_INSTALL_DIR}/bin:${BREW_INSTALL_DIR}/sbin
2424
RUN --mount=type=cache,id=openclaw-sandbox-common-apt-cache,target=/var/cache/apt,sharing=locked \
2525
--mount=type=cache,id=openclaw-sandbox-common-apt-lists,target=/var/lib/apt,sharing=locked \
2626
apt-get update \
27-
&& apt-get install -y --no-install-recommends ${PACKAGES} \
27+
&& apt-get install -y --no-install-recommends ${PACKAGES}
2828

2929
RUN if [ "${INSTALL_PNPM}" = "1" ]; then npm install -g pnpm; fi
3030

scripts/docker/cleanup-smoke/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ RUN --mount=type=cache,id=openclaw-cleanup-smoke-apt-cache,target=/var/cache/apt
88
&& apt-get install -y --no-install-recommends \
99
bash \
1010
ca-certificates \
11-
git \
11+
git
1212

1313
WORKDIR /repo
1414
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./

src/docker-build-cache.test.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,32 @@ describe("docker build cache layout", () => {
5656
}
5757
});
5858

59+
it("does not leave empty shell continuation lines in sandbox-common", async () => {
60+
const dockerfile = await readRepoFile("Dockerfile.sandbox-common");
61+
expect(dockerfile).not.toContain("apt-get install -y --no-install-recommends ${PACKAGES} \\");
62+
expect(dockerfile).toContain(
63+
'RUN if [ "${INSTALL_PNPM}" = "1" ]; then npm install -g pnpm; fi',
64+
);
65+
});
66+
67+
it("does not leave blank lines after shell continuation markers", async () => {
68+
for (const path of [
69+
"Dockerfile.sandbox",
70+
"Dockerfile.sandbox-browser",
71+
"Dockerfile.sandbox-common",
72+
"scripts/docker/cleanup-smoke/Dockerfile",
73+
"scripts/docker/install-sh-smoke/Dockerfile",
74+
"scripts/docker/install-sh-e2e/Dockerfile",
75+
"scripts/docker/install-sh-nonroot/Dockerfile",
76+
]) {
77+
const dockerfile = await readRepoFile(path);
78+
expect(
79+
dockerfile,
80+
`${path} should not have blank lines after a trailing backslash`,
81+
).not.toMatch(/\\\n\s*\n/);
82+
}
83+
});
84+
5985
it("copies only install inputs before pnpm install in the e2e image", async () => {
6086
const dockerfile = await readRepoFile("scripts/e2e/Dockerfile");
6187
const installIndex = dockerfile.indexOf("pnpm install --frozen-lockfile");

0 commit comments

Comments
 (0)