From b7cf28f4070eb99b626ffe1c22a215eb3b057891 Mon Sep 17 00:00:00 2001 From: Sebastian <19554889+sebslight@users.noreply.github.com> Date: Mon, 16 Feb 2026 22:27:41 -0500 Subject: [PATCH] test(docker): cover browser install build arg --- CHANGELOG.md | 1 + src/dockerfile.test.ts | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 src/dockerfile.test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 237103ac5f..a5ddab84b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ Docs: https://docs.openclaw.ai - Discord: allow reusable interactive components with `components.reusable=true` so buttons, selects, and forms can be used multiple times before expiring. Thanks @thewilloftheshadow. - Cron/Gateway: separate per-job webhook delivery (`delivery.mode = "webhook"`) from announce delivery, enforce valid HTTP(S) webhook URLs, and keep a temporary legacy `notify + cron.webhook` fallback for stored jobs. (#17901) Thanks @advaitpaliwal. - Discord: add per-button `allowedUsers` allowlist for interactive components to restrict who can click buttons. Thanks @thewilloftheshadow. +- Docker: add optional `OPENCLAW_INSTALL_BROWSER` build arg to preinstall Chromium + Xvfb in the Docker image, avoiding runtime Playwright installs. (#18449) ### Fixes diff --git a/src/dockerfile.test.ts b/src/dockerfile.test.ts new file mode 100644 index 0000000000..4e75caeb42 --- /dev/null +++ b/src/dockerfile.test.ts @@ -0,0 +1,23 @@ +import { readFile } from "node:fs/promises"; +import { join, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; +import { describe, expect, it } from "vitest"; + +const repoRoot = resolve(fileURLToPath(new URL(".", import.meta.url)), ".."); +const dockerfilePath = join(repoRoot, "Dockerfile"); + +describe("Dockerfile", () => { + it("installs optional browser dependencies after pnpm install", async () => { + const dockerfile = await readFile(dockerfilePath, "utf8"); + const installIndex = dockerfile.indexOf("RUN pnpm install --frozen-lockfile"); + const browserArgIndex = dockerfile.indexOf("ARG OPENCLAW_INSTALL_BROWSER"); + + expect(installIndex).toBeGreaterThan(-1); + expect(browserArgIndex).toBeGreaterThan(-1); + expect(browserArgIndex).toBeGreaterThan(installIndex); + expect(dockerfile).toContain( + "node /app/node_modules/playwright-core/cli.js install --with-deps chromium", + ); + expect(dockerfile).toContain("apt-get install -y --no-install-recommends xvfb"); + }); +});