You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 56a837b
Browse filesBrowse the repository at this point in the historyBrowse files
fix(claude-code): consolidate onto system Chromium to shrink image (#83)
The daily-rebuilt image grew from ~600MB to ~1.07GB because two
Chromium installs ran side-by-side: Playwright's --only-shell bake
(which still pulls Firefox+WebKit despite the flag) and apt chromium
pulled transitively by agent-browser install --with-deps.
Align with the project's own .claude/rules/dockerfile.md convention:
install system chromium via apt and set PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
+ PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=/usr/bin/chromium. Drop the
Playwright install-deps and browser-bake RUNs, drop the redundant
npx playwright install from both devcontainer.json postCreate/updateContent
commands, and move the agent-browser install to run as the node user so
no subsequent chown -R duplicates 452MB of claude-code files via overlayfs.
Measured (linux/amd64):
- default: ~1.07GB -> 660MB (-38%)
- sandbox: 3.09GB -> 350MB (-89%)
Closes#82
@@ -56,7 +55,7 @@ Copy these to your project's `.devcontainer/`:
56
55
-[`.devcontainer/docker-compose.yml`](.devcontainer/docker-compose.yml) — image reference with `pull_policy: always`
57
56
-[`.devcontainer/devcontainer.json`](.devcontainer/devcontainer.json) — full config with VS Code extensions, fish shell, OXC formatter, node_modules volume isolation, and lifecycle commands
58
57
59
-
**Key settings included:** fish + bash terminal profiles, OXC formatter (with comments for switching to Biome/Prettier), node_modules/Claude config/fish history volume mounts, and `updateContentCommand` for mise/bun/Playwright setup.
58
+
**Key settings included:** fish + bash terminal profiles, OXC formatter (with comments for switching to Biome/Prettier), node_modules/Claude config/fish history volume mounts, and `updateContentCommand` for mise/bun setup.
60
59
61
60
### Sandbox variant
62
61
@@ -212,37 +211,46 @@ The template only mounts root `node_modules` by default. For monorepo projects,
212
211
213
212
The `sudo find` in `updateContentCommand` chowns all `node_modules` directories in one pass, so additional mounts are handled automatically.
214
213
215
-
## Playwright Version Strategy
214
+
## Playwright Strategy
216
215
217
-
The image uses a two-layer strategy so that any project can use any `@playwright/test` version:
216
+
The image uses the system `chromium` package (apt-installed in the `default`
217
+
target) instead of Playwright-managed browser binaries. This avoids version
218
+
coupling between `@playwright/mcp` (alpha `playwright-core` builds) and cached
219
+
binaries, and keeps the image significantly smaller than shipping a
220
+
Playwright-managed Chromium per rebuild.
218
221
219
-
| Layer | What | Baked in image? | Version-sensitive? |
| System deps (`install-deps`) | OS libraries (libgbm, libnss3, …) | Yes (needs root) | Stable across nearby versions |
222
-
| Browser binary (`install --only-shell`) | Headless Chromium shell | Yes, as cache | Exact match required |
223
-
224
-
**Prerequisite:** Your project must have `@playwright/test` in `devDependencies`. Without it, `npx` will prompt interactively to download the `playwright` package, which hangs container creation (no TTY). Pin it to the image's baked version (check `$PLAYWRIGHT_VERSION`) or your preferred version:
222
+
The Dockerfile sets:
225
223
226
224
```bash
227
-
bun add -d @playwright/test # or: npm install -D @playwright/test
**One-time project setup** — add this to your container creation command (`updateContentCommand` or `postCreateCommand`, as shown in [Quick Start](#quick-start)):
231
-
232
-
```bash
233
-
npx playwright install --only-shell chromium
229
+
`PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH` is a project convention — Playwright
230
+
does **not** read it automatically. Each project's `playwright.config.ts`
This is **idempotent** — if the cached binary already matches, it's a no-op (~0s). If the project's `@playwright/test` version differs from the image, it downloads the correct binary (~10s, once at container creation).
237
-
238
-
The baked version is available at runtime via the `PLAYWRIGHT_VERSION` environment variable.
244
+
**Sandbox note:**`chromium` is installed only in the `default` target.
245
+
Projects using the `sandbox` image that need browser testing should add
246
+
chromium themselves (via a thin downstream Dockerfile or container
247
+
`postStart`).
239
248
240
249
## Build Args
241
250
242
251
| Arg | Default | Description |
243
252
|-----|---------|-------------|
244
253
|`GIT_DELTA_VERSION`|`0.18.2`| git-delta version |
245
-
|`PLAYWRIGHT_VERSION`|`1.58.2`| Playwright browser binary version |
246
254
|`AGENT_BROWSER_VERSION`|`latest`| agent-browser version (default target only) |
247
255
248
256
## Building Locally / Local Fallback
@@ -311,25 +319,16 @@ docker buildx build \
311
319
312
320
## Startup Timeline
313
321
314
-
### Warm start (Playwright version matches image)
315
322
```
316
323
Pull image ──────────────────────── (cached)
317
324
mise install (bun, hugo, etc.) ──── (~15s, downloads pre-built binaries)
318
325
bun install ─────────────────────── (~15s, cached in named volume)
0 commit comments