Skip to content

Slim CI image: drop unused firefox/webkit/chrome#2

Open
twschiller wants to merge 1 commit into
mainfrom
slim-image-drop-unused-browsers
Open

Slim CI image: drop unused firefox/webkit/chrome#2
twschiller wants to merge 1 commit into
mainfrom
slim-image-drop-unused-browsers

Conversation

@twschiller

Copy link
Copy Markdown

Why

On the monorepo E2E job, the built-in "Initialize containers" step takes ~10 min, essentially all of it a single docker pull of this image — longer than the tests themselves (pixiebrix/pixiebrix-source#9209). By contrast the Docker Hub service images (postgres, redis) pull in ~2s because Blacksmith mirrors docker.io; this GHCR image is pulled uncached. It's paid on every shard (chromium×4 + msedge×4, more with foundever).

The batteries-included mcr.microsoft.com/playwright base bakes firefox + webkit into its base layers, so they're pulled on every job even though neither E2E suite uses them:

  • webext-e2e launches the chromium and msedge channels
  • web-app-e2e uses bundled chromium (devices["Desktop Chrome"] is a viewport/UA descriptor, not the chrome channel)
  • the chrome channel is disabled (pixiebrix/pixiebrix-source#2797)

What

  • Build on the official Node base (node:24.18.0-bookworm, pinned to the monorepo's Node — Node publishes no Ubuntu -noble image; Playwright supports Debian 12) and install only chromium + msedge + msedge-beta with --with-deps.
  • Set PLAYWRIGHT_BROWSERS_PATH=/ms-playwright and recreate the uid-1001 pwuser, mirroring the official image layout, so browsers resolve at runtime without re-downloading and --user 1001 keeps working. (This preserves the pull-vs-post-pull-install balance: browsers are baked at image-build time, not installed during monorepo CI.)
  • Update release.yml to derive the image tag from the @playwright/test@<version> pin, since the FROM mcr.microsoft.com/playwright:vX.Y.Z line it previously grepped is gone.

Rollout / risk

The tag is version-derived, so the Playwright pin is unchanged (1.57.0) → this republishes 1.57.0 (and latest) in place, same as the existing 3-day auto-rebuild. The monorepo already references 1.57.0, so it picks up the slimmed image on the next pull with no monorepo change.

Because I can't build/run the image locally, please validate before relying on it — e.g. build to a scratch tag and run a monorepo E2E pass, or merge during a quiet window with a revert ready. Two things to confirm on the new base:

  1. playwright install --with-deps msedge msedge-beta resolves the Edge channels on Debian bookworm.
  2. Browsers under /ms-playwright (perms a+rX) are readable/executable by uid 1001 at runtime with no re-download.

Refs pixiebrix/pixiebrix-source#9209

The CI E2E job's "Initialize containers" step spends ~10 min pulling this
image (pixiebrix-source#9209) — the whole overrun, and far longer than the
tests themselves. The batteries-included mcr.microsoft.com/playwright base
bakes firefox + webkit into its layers, so they're pulled on every shard even
though neither E2E suite uses them:

  - webext-e2e launches the `chromium` and `msedge` channels
  - web-app-e2e uses bundled `chromium`
  - the `chrome` channel is disabled (pixiebrix-source#2797)

Build on the official Node base (pinned to the monorepo's Node) and install
only chromium + msedge + msedge-beta with --with-deps. Set
PLAYWRIGHT_BROWSERS_PATH=/ms-playwright and recreate uid-1001 pwuser to match
the official image layout so the browsers resolve at runtime (no re-download)
and `--user 1001` keeps working. Update release.yml to derive the image tag
from the @playwright/test pin instead of the (now removed) mcr FROM line.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@unblocked unblocked Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found.

About Unblocked

Unblocked has been set up to automatically review your team's pull requests to identify genuine bugs and issues.

📖 Documentation — Learn more in our docs.

💬 Ask questions — Mention @unblocked to request a review or summary, or ask follow-up questions.

👍 Give feedback — React to comments with 👍 or 👎 to help us improve.

⚙️ Customize — Adjust settings in your preferences.

Comment thread Dockerfile
Comment on lines +24 to +26
RUN npx --yes @playwright/test@1.57.0 install --with-deps chromium msedge msedge-beta && \
chmod -R a+rX /ms-playwright && \
rm -rf /var/lib/apt/lists/*

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

npx --yes @playwright/test@1.57.0 downloads the package into npm's cache (/root/.npm) and npx's staging area before running the install sub-command. These artefacts are never cleaned up, so they remain in this layer permanently. Given the PR's goal is to shrink pull time, it's worth purging them in the same RUN:

Suggested change
RUN npx --yes @playwright/test@1.57.0 install --with-deps chromium msedge msedge-beta && \
chmod -R a+rX /ms-playwright && \
rm -rf /var/lib/apt/lists/*
RUN npx --yes @playwright/test@1.57.0 install --with-deps chromium msedge msedge-beta && \
chmod -R a+rX /ms-playwright && \
rm -rf /var/lib/apt/lists/* /root/.npm /tmp/*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant