mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
Docker: fix sandbox cache mount continuations
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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 ./
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user