-
Notifications
You must be signed in to change notification settings - Fork 0
Slim CI image: drop unused firefox/webkit/chrome #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
twschiller
wants to merge
1
commit into
main
Choose a base branch
from
slim-image-drop-unused-browsers
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,37 @@ | ||
| # Keep the image up to date with https://playwright.dev/docs/docker#pull-the-image | ||
| # Once updated here, also use the correct tag in the monorepo's workflow | ||
| FROM mcr.microsoft.com/playwright:v1.57.0-noble | ||
| # PixieBrix container image for GitHub Actions E2E (webext-e2e + web-app-e2e). | ||
| # | ||
| # Slimmed to only the browsers our suites actually launch: | ||
| # - webext-e2e: the `chromium` and `msedge` channels | ||
| # - web-app-e2e: bundled `chromium` | ||
| # The `chrome` channel is disabled (pixiebrix-source#2797) and firefox/webkit are | ||
| # unused by both suites. We therefore build on a plain Node base and install just | ||
| # those browsers, instead of the batteries-included mcr.microsoft.com/playwright | ||
| # image, which bakes firefox + webkit into its base layers and roughly doubles the | ||
| # image pull time on CI (see pixiebrix-source#9209). | ||
| # | ||
| # Node is pinned to the monorepo's version (package.json engines / .nvmrc). Node's | ||
| # official images are Debian-based (there is no Ubuntu `-noble` variant); Playwright | ||
| # supports Debian 12 (bookworm). | ||
| FROM node:24.18.0-bookworm | ||
|
|
||
| # List all the browsers including those that are included by default | ||
| RUN npx @playwright/test@1.57.0 install --with-deps chrome chromium msedge msedge-beta | ||
| # Match the official Playwright image layout so Playwright resolves the browsers at | ||
| # runtime without re-downloading them. The monorepo workflow runs the container as | ||
| # `--user 1001`, so the installed browsers must be readable/executable by that uid. | ||
| ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright | ||
|
|
||
| # Keep 3 commands in one RUN to save space in the image. rm -rf also cleans up the cache | ||
| # Re-set root around apt-get | ||
| USER root | ||
| # Keep the Playwright version in sync with the monorepo's @playwright/test pin. | ||
| # The release workflow derives the published image tag from this version string. | ||
| 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/* | ||
|
|
||
| # Extra native deps used elsewhere in CI (xmlsec, etc.). | ||
| RUN apt-get update && \ | ||
| apt-get install -y libxmlsec1 libxmlsec1-dev libxml2 pkg-config lsb-release python3-pip && \ | ||
| rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # The monorepo runs this container as `--user 1001`; create that user (mirrors the | ||
| # official image's `pwuser`) so $HOME and npm caches resolve to a writable path. | ||
| RUN groupadd --gid 1001 pwuser && \ | ||
| useradd --uid 1001 --gid 1001 --create-home --shell /bin/bash pwuser | ||
| USER 1001 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.0downloads the package into npm's cache (/root/.npm) and npx's staging area before running theinstallsub-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 sameRUN: