From 8e333936684549cefd372bd2cc5b2e044344ca85 Mon Sep 17 00:00:00 2001 From: HenryHaniHannoush Date: Sun, 5 Jul 2026 23:38:52 +0300 Subject: [PATCH] fix(docker): add id= to BuildKit cache mounts for strict builders (#6291) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merged into release/v3.8.45. Dockerfile-only: explicit id= on BuildKit cache mounts (fixes strict-frontend parse error). Reds pré-existentes (dast-smoke/file-size drift) não relacionados a mudança de Dockerfile. Thanks @karimalsalah. --- Dockerfile | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 92894f55c2..0a640d5a47 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,8 +8,8 @@ WORKDIR /app # that already have a fix published in trixie. CVEs without an upstream fix yet # (local-only TOCTOU, etc.) remain until the distro patches them and the image # is rebuilt; none are reachable from the proxy's request surface at runtime. -RUN --mount=type=cache,target=/var/cache/apt,sharing=shared \ - --mount=type=cache,target=/var/lib/apt/lists,sharing=shared \ +RUN --mount=type=cache,id=apt-cache,target=/var/cache/apt,sharing=shared \ + --mount=type=cache,id=apt-lists,target=/var/lib/apt/lists,sharing=shared \ apt-get update \ && apt-get upgrade -y \ && apt-get install -y --no-install-recommends libsecret-1-0 ca-certificates \ @@ -29,8 +29,8 @@ FROM base AS builder # Build tools for native module compilation # apt-get update needed here because base's rm -rf clears the shared cache -RUN --mount=type=cache,target=/var/cache/apt,sharing=shared \ - --mount=type=cache,target=/var/lib/apt/lists,sharing=shared \ +RUN --mount=type=cache,id=apt-cache,target=/var/cache/apt,sharing=shared \ + --mount=type=cache,id=apt-lists,target=/var/lib/apt/lists,sharing=shared \ apt-get update \ && apt-get install -y --no-install-recommends python3 make g++ \ && rm -rf /var/lib/apt/lists/* @@ -55,7 +55,7 @@ ENV NPM_CONFIG_LEGACY_PEER_DEPS=true # are reproducible. RUN test -f package-lock.json \ || (echo "package-lock.json is required for reproducible Docker builds" >&2 && exit 1) -RUN --mount=type=cache,target=/root/.npm \ +RUN --mount=type=cache,id=npm-cache,target=/root/.npm \ npm ci --no-audit --no-fund --legacy-peer-deps --ignore-scripts \ && npm rebuild better-sqlite3 \ && node -e "require('better-sqlite3')(':memory:').close()" @@ -83,7 +83,7 @@ ARG OMNIROUTE_BUILD_MEMORY_MB=4096 ENV NODE_OPTIONS="--max-old-space-size=${OMNIROUTE_BUILD_MEMORY_MB}" COPY . ./ -RUN --mount=type=cache,target=/app/.build/next/cache \ +RUN --mount=type=cache,id=next-cache,target=/app/.build/next/cache \ mkdir -p /app/data && npm run build # ── Runner base ──────────────────────────────────────────────────────────── @@ -179,8 +179,8 @@ COPY --from=builder /app/node_modules/playwright ./node_modules/playwright # browsers land under /home/node which persists across image layers and is # accessible to the non-root runtime user. ENV PLAYWRIGHT_BROWSERS_PATH=/home/node/.cache/ms-playwright -RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ - --mount=type=cache,target=/var/lib/apt/lists,sharing=locked \ +RUN --mount=type=cache,id=apt-cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,id=apt-lists,target=/var/lib/apt/lists,sharing=locked \ apt-get update \ && node node_modules/playwright/cli.js install chromium --with-deps \ && chown -R node:node /home/node/.cache \ @@ -196,15 +196,15 @@ FROM runner-base AS runner-cli USER root # Install system dependencies required by openclaw (git+ssh references). -RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ - --mount=type=cache,target=/var/lib/apt/lists,sharing=locked \ +RUN --mount=type=cache,id=apt-cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,id=apt-lists,target=/var/lib/apt/lists,sharing=locked \ apt-get update \ && apt-get install -y --no-install-recommends git ca-certificates docker.io docker-compose \ && rm -rf /var/lib/apt/lists/* \ && git config --system url."https://github.com/".insteadOf "ssh://git@github.com/" # Install CLI tools globally. Separate layer from apt for better cache reuse. -RUN --mount=type=cache,target=/root/.npm \ +RUN --mount=type=cache,id=npm-cache,target=/root/.npm \ npm install -g --no-audit --no-fund @openai/codex @anthropic-ai/claude-code droid openclaw@latest USER node