From ea9d22bedac0f0cf0b78d67c4e242810b7bc26d5 Mon Sep 17 00:00:00 2001 From: diegosouzapw Date: Mon, 8 Jun 2026 16:14:26 -0300 Subject: [PATCH] fix(docker): copy playwright from builder instead of npx fetch in runner-web MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit npx playwright falls back to a registry download when playwright is absent from the slim runtime image's node_modules. On GitHub-hosted runners this download fails with exit 127, breaking both amd64 and arm64 -web image builds. Fix: COPY playwright and playwright-core from the builder stage and invoke node node_modules/playwright/cli.js directly — no network access, same version, and playwright remains available at runtime for web-session providers. --- Dockerfile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 4edad547e9..6056be468b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -124,6 +124,14 @@ FROM runner-base AS runner-web USER root +# Copy playwright and playwright-core from the builder stage. +# The slim runtime image does not have playwright in node_modules, so npx falls +# back to a registry download — unreliable on CI runners (exits 127 on failure). +# Copying from the builder avoids any network access at image-build time and also +# ensures the same playwright version is available at runtime for web-session providers. +COPY --from=builder /app/node_modules/playwright-core ./node_modules/playwright-core +COPY --from=builder /app/node_modules/playwright ./node_modules/playwright + # Install Playwright browser binaries + OS dependencies under root, then hand # ownership of the browsers cache to the node user. # PLAYWRIGHT_BROWSERS_PATH overrides the default ~/.cache/ms-playwright so the @@ -133,7 +141,7 @@ 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 \ apt-get update \ - && npx playwright install chromium --with-deps \ + && node node_modules/playwright/cli.js install chromium --with-deps \ && chown -R node:node /home/node/.cache \ && rm -rf /var/lib/apt/lists/*