CI and containers

The checks you run on your computer run unchanged in CI: npx brokit check, which exits 1 when something failed. This page has recipes for GitHub Actions, Docker and GitLab CI, and what to know about baselines, Chrome's sandbox and AI agents.

Run npx brokit doctor first wherever brokit is new: it says what's missing and how to add it. A failing check leaves its screenshots and difference images in brokit-out/; keep that folder as the job's artifact, so you can see what changed.

Baselines in CI#

GitHub Actions#

GitHub's hosted Linux, macOS and Windows runners come with Chrome, and run jobs on a virtual machine, not in a container, so Chrome's sandbox works as it is. (This recipe hasn't been verified on GitHub yet.)

YAML
name: checks
on: [push, pull_request]

jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 22
      - run: npm ci
      - run: npx brokit check
      - if: failure()
        uses: actions/upload-artifact@v4
        with:
          name: brokit-out
          path: brokit-out/

With a pinned Chrome, install it before the checks, and cache brokit's download:

YAML
      - uses: actions/cache@v4
        with:
          path: ~/.cache/brokit
          key: brokit-chrome-${{ hashFiles('package.json') }}
      - run: npx brokit install-chrome
      - run: npx brokit check

Against your app's dev server, start it first and point brokit at it:

YAML
      - run: npm run dev &
      - run: npx brokit check --base http://localhost:5173/

Give the checks a ready signal (or a first waitFor step) so they wait for the server to answer.

Docker#

Verified on 2026-10-27 with node:22-bookworm-slim and Debian's Chromium:

Dockerfile
FROM node:22-bookworm-slim
RUN apt-get update \
 && apt-get install -y --no-install-recommends chromium fonts-liberation \
 && rm -rf /var/lib/apt/lists/*
USER node
WORKDIR /home/node/app
COPY --chown=node . .
RUN npm ci
CMD ["npx", "brokit", "check"]
shell
docker build -t my-checks .
docker run --security-opt=seccomp=unconfined my-checks

Two things are required, and brokit says so when they're missing:

To make or update baselines in the same image CI uses, run npx brokit check --update in a container of that image and copy the baselines folders out of it (docker cp), or let a CI job run it and keep the baselines as an artifact.

Where the container's settings can't be changed#

Some CI systems run every job in a container whose settings you can't change: GitLab.com's shared runners, GitHub jobs that run in a container:. There, set BROKIT_NO_SANDBOX=1. Chrome then runs without its sandbox, inside the container, which keeps it apart from the computer. brokit honors it only inside a container, opens only pages on this computer with it, and says so on every run; root is fine then. (Verified on 2026-10-27 in Docker with default settings, as root and as node.) See SECURITY.md.

GitLab CI#

Jobs run in a container, so the runner must allow Chrome's sandbox. On a runner you manage, set it in its config.toml (this recipe hasn't been verified on GitLab yet):

TOML
[runners.docker]
  security_opt = ["seccomp=unconfined"]
YAML
check:
  image: node:22-bookworm-slim
  before_script:
    - apt-get update && apt-get install -y --no-install-recommends chromium fonts-liberation
    - npm ci
    - chown -R node .
  script:
    - su node -c "npx brokit check"
  artifacts:
    when: on_failure
    paths: [brokit-out/]

GitLab.com's shared runners don't let a job change its container's settings, so Chrome's sandbox can't start there; run without it:

YAML
check:
  image: node:22-bookworm-slim
  variables:
    BROKIT_NO_SANDBOX: "1"   # in this container only; see SECURITY.md
  before_script:
    - apt-get update && apt-get install -y --no-install-recommends chromium fonts-liberation
    - npm ci
  script:
    - npx brokit check
  artifacts:
    when: on_failure
    paths: [brokit-out/]

AI agents#

An AI coding agent can use brokit to see and use what it builds: open a page, click through it, read values and look at screenshots.

A prompt that works well: "After changing the UI, run npx brokit run <page> --out shot.png --json, read the JSON for console errors, and look at shot.png before saying you're done."

Edit this page on GitHub