From d6aa9adec518b5de3fb80992abe50ead97ac9311 Mon Sep 17 00:00:00 2001 From: JayMishra-github Date: Mon, 16 Feb 2026 10:19:32 -0800 Subject: [PATCH] feat(docker): add optional Chromium + Xvfb install in Docker image Adds a build arg OPENCLAW_INSTALL_BROWSER that, when set, pre-installs Chromium (via Playwright) and Xvfb into the Docker image. This eliminates the 60-90 second Playwright install that otherwise happens on every container start when browser features are used. Usage: docker build --build-arg OPENCLAW_INSTALL_BROWSER=1 -t openclaw:browser . Without the build arg, behavior is unchanged (no Chromium in image). Co-Authored-By: Claude Opus 4.6 --- Dockerfile | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Dockerfile b/Dockerfile index 4f9d06c2d2..8e037244d6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,18 @@ RUN if [ -n "$OPENCLAW_DOCKER_APT_PACKAGES" ]; then \ rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*; \ fi +# Optionally install Chromium and Xvfb for browser automation. +# Build with: docker build --build-arg OPENCLAW_INSTALL_BROWSER=1 ... +# Adds ~300MB but eliminates the 60-90s Playwright install on every container start. +ARG OPENCLAW_INSTALL_BROWSER="" +RUN if [ -n "$OPENCLAW_INSTALL_BROWSER" ]; then \ + apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends xvfb && \ + npx playwright install --with-deps chromium && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*; \ + fi + COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc ./ COPY ui/package.json ./ui/package.json COPY patches ./patches