Skip to content

Commit b3ecfa5

Browse files
authored
fix(claude-code): limit Playwright browser download to Chromium only (#78) (#79)
`--only-shell` controls the variant (headless shell vs full browser) but does not limit which browsers get installed. Without specifying `chromium`, all three browsers are downloaded (~290 MiB), wasting ~184 MiB on Firefox and WebKit that are never used.
1 parent 8e11bf5 commit b3ecfa5

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎claude-code/.devcontainer/Dockerfile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ COPY --from=ralphex-download /usr/local/bin/ralphex /usr/local/bin/ralphex
142142
# 1. System deps (install-deps) — heavy, needs root, version-stable across
143143
# nearby releases. Baked into the image so projects don't need sudo.
144144
# 2. Browser binary (install --only-shell) — light, version-specific.
145-
# Baked as a cache; projects MUST run `npx playwright install --only-shell`
145+
# Baked as a cache; projects MUST run `npx playwright install --only-shell chromium`
146146
# at container creation to ensure the binary matches their @playwright/test.
147147
# That command is idempotent: no-op when versions match, ~10s download if not.
148148
USER root

‎claude-code/.devcontainer/claude-sandbox/devcontainer.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
},
123123
// Runs before postStartCommand (firewall), so network is still available for browser downloads.
124124
// The find command chowns all node_modules volume mount points in one pass.
125-
"postCreateCommand": "sudo find /workspace -maxdepth 4 -name node_modules -type d -exec chown node {} + && sudo chown -R node /home/node/.claude && mise install && bun install && npx playwright install --only-shell",
125+
"postCreateCommand": "sudo find /workspace -maxdepth 4 -name node_modules -type d -exec chown node {} + && sudo chown -R node /home/node/.claude && mise install && bun install && npx playwright install --only-shell chromium",
126126
// Firewall init — script is bind-mounted from the project
127127
"postStartCommand": "sudo /usr/local/bin/init-firewall.sh",
128128
"waitFor": "postStartCommand"

‎claude-code/.devcontainer/devcontainer.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,6 @@
110110
// mise install reads .mise.toml and installs project-specific tool versions.
111111
// playwright install ensures the correct browser binary for the project's @playwright/test version
112112
// (idempotent — skips download if the image's cached binary already matches).
113-
"updateContentCommand": "sudo find /workspace -maxdepth 4 -name node_modules -type d -exec chown node {} + && sudo chown -R node /home/node/.claude && mise install && bun install && npx playwright install --only-shell",
113+
"updateContentCommand": "sudo find /workspace -maxdepth 4 -name node_modules -type d -exec chown node {} + && sudo chown -R node /home/node/.claude && mise install && bun install && npx playwright install --only-shell chromium",
114114
"waitFor": "postCreateCommand"
115115
}

‎claude-code/README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ bun add -d @playwright/test # or: npm install -D @playwright/test
230230
**One-time project setup** — add this to your container creation command (`updateContentCommand` or `postCreateCommand`, as shown in [Quick Start](#quick-start)):
231231

232232
```bash
233-
npx playwright install --only-shell
233+
npx playwright install --only-shell chromium
234234
```
235235

236236
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).
@@ -316,7 +316,7 @@ docker buildx build \
316316
Pull image ──────────────────────── (cached)
317317
mise install (bun, hugo, etc.) ──── (~15s, downloads pre-built binaries)
318318
bun install ─────────────────────── (~15s, cached in named volume)
319-
playwright install --only-shell ─── (~0s, binary already cached — no-op)
319+
playwright install --only-shell chromium (~0s, binary already cached — no-op)
320320
project setup ───────────────────── (db:migrate, init-plugins, etc.)
321321
Total: ~45s warm
322322
```
@@ -326,7 +326,7 @@ project setup ───────────────────── (d
326326
Pull image ──────────────────────── (cached)
327327
mise install (bun, hugo, etc.) ──── (~15s)
328328
bun install ─────────────────────── (~15s)
329-
playwright install --only-shell ─── (~10s, downloads correct browser binary)
329+
playwright install --only-shell chromium (~10s, downloads correct browser binary)
330330
project setup ───────────────────── (db:migrate, init-plugins, etc.)
331331
Total: ~55s warm
332332
```

0 commit comments

Comments
 (0)