Add browsers for tests: Playwright, Firefox, geckodriver, headless Chrome (closes #10)
Firefox comes from Mozilla's own apt repo since Ubuntu's is a snap that does not run in a container. geckodriver is matched to it at build time. Playwright installs its Chromium and Firefox, skipping WebKit which has no linux-arm64 build; Playwright's Chromium is exposed as the headless Chrome. Model: deepseek-v4-pro
This commit is contained in:
@@ -20,6 +20,7 @@ ENV LANG=C.UTF-8 \
|
||||
COREPACK_ENABLE_DOWNLOAD_PROMPT=0 \
|
||||
COREPACK_ENABLE_AUTO_PIN=0 \
|
||||
PYENV_ROOT=/usr/local/pyenv \
|
||||
PLAYWRIGHT_BROWSERS_PATH=/ms-playwright \
|
||||
GOPATH=/root/go \
|
||||
PATH=/usr/local/go/bin:/root/go/bin:/usr/local/nvm/current/bin:/usr/local/pyenv/shims:/usr/local/pyenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
|
||||
@@ -30,6 +30,11 @@ Image: `git.eeqj.de/sneak/baseimage`, built for `linux/amd64` and
|
||||
| yarn, pnpm | corepack, cache pre-populated | `/usr/local/corepack` |
|
||||
| wrangler | `npm install -g wrangler` | nvm LTS global bin |
|
||||
| prettier | `npm install -g prettier` | nvm LTS global bin |
|
||||
| Playwright | `npm install -g playwright` | nvm LTS global bin |
|
||||
| Playwright browsers | `playwright install` (chromium, firefox) | `/ms-playwright` |
|
||||
| Firefox | Mozilla apt repo | `/usr/bin/firefox` |
|
||||
| geckodriver | GitHub release | `/usr/local/bin/geckodriver` |
|
||||
| headless Chrome | Playwright Chromium | `chromium` on `PATH` |
|
||||
| Python (distro) | apt `python3`, `pip`, `venv` | `/usr/bin/python3` |
|
||||
| pyenv | git tag | `/usr/local/pyenv` |
|
||||
| Python (latest) | `pyenv install` | `/usr/local/pyenv/versions/*` |
|
||||
@@ -68,7 +73,8 @@ dependencies in child images.
|
||||
|
||||
Environment variables set in the image: `NVM_DIR`, `NVM_SYMLINK_CURRENT`,
|
||||
`COREPACK_HOME`, `COREPACK_ENABLE_DOWNLOAD_PROMPT=0`,
|
||||
`COREPACK_ENABLE_AUTO_PIN=0`, `PYENV_ROOT`, `GOPATH`, `LANG=C.UTF-8`.
|
||||
`COREPACK_ENABLE_AUTO_PIN=0`, `PYENV_ROOT`, `GOPATH`, `LANG=C.UTF-8`,
|
||||
`PLAYWRIGHT_BROWSERS_PATH`.
|
||||
|
||||
### Yarn and corepack
|
||||
|
||||
@@ -93,7 +99,7 @@ the `Dockerfile`:
|
||||
|
||||
Everything else resolves to its current release at build time: Ubuntu
|
||||
packages, Go, Node LTS, Python, Hugo, golangci-lint, npm, yarn, pnpm,
|
||||
wrangler.
|
||||
wrangler, prettier, Playwright and its browsers, Firefox, geckodriver.
|
||||
|
||||
## Services and init
|
||||
|
||||
|
||||
@@ -35,6 +35,10 @@ vips -l | grep -i heif > /dev/null
|
||||
valkey-server --version
|
||||
valkey-cli --version
|
||||
psql --version
|
||||
playwright --version
|
||||
firefox --version
|
||||
geckodriver --version
|
||||
chromium --version
|
||||
'
|
||||
|
||||
echo "== $img: runit service lifecycle"
|
||||
|
||||
@@ -68,7 +68,7 @@ nvm install --lts
|
||||
nvm alias default "lts/*"
|
||||
nvm use default
|
||||
set -ux
|
||||
npm install -g npm@latest corepack wrangler prettier
|
||||
npm install -g npm@latest corepack wrangler prettier playwright
|
||||
corepack enable
|
||||
# Pre-populate the corepack cache so projects that pin a package manager
|
||||
# do not download at run time. The last yarn installed becomes the default.
|
||||
@@ -81,6 +81,33 @@ pnpm --version
|
||||
yarn --version
|
||||
nvm cache clear
|
||||
|
||||
# --- browsers for tests: Firefox, geckodriver, Playwright --------------------
|
||||
# Ubuntu's firefox is a snap that does not run in a container, so use
|
||||
# Mozilla's own apt repository for the real binary.
|
||||
install -d -m 0755 /etc/apt/keyrings
|
||||
curl -fsSL https://packages.mozilla.org/apt/repo-signing-key.gpg \
|
||||
-o /etc/apt/keyrings/packages.mozilla.org.asc
|
||||
echo "deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://packages.mozilla.org/apt mozilla main" \
|
||||
> /etc/apt/sources.list.d/mozilla.list
|
||||
apt-get update
|
||||
apt-get -y install --no-install-recommends -t mozilla firefox
|
||||
|
||||
# geckodriver, matched to Firefox at its current release.
|
||||
gd="$(latest_tag mozilla/geckodriver)"
|
||||
case "$arch" in
|
||||
arm64) gd_arch=linux-aarch64 ;;
|
||||
*) gd_arch=linux64 ;;
|
||||
esac
|
||||
curl -fsSL "https://github.com/mozilla/geckodriver/releases/download/${gd}/geckodriver-${gd}-${gd_arch}.tar.gz" |
|
||||
tar -C /usr/local/bin -xz geckodriver
|
||||
|
||||
# Playwright's Chromium and Firefox. WebKit has no linux-arm64 build, so it
|
||||
# is skipped. Playwright's Chromium is also the headless Chrome for
|
||||
# chromedp-style clients, exposed as `chromium` on PATH.
|
||||
playwright install --with-deps chromium firefox
|
||||
ln -s "$(ls -d "$PLAYWRIGHT_BROWSERS_PATH"/chromium-*/chrome-linux*/chrome | head -n1)" \
|
||||
/usr/local/bin/chromium
|
||||
|
||||
# --- pyenv, Python (latest), pip, virtualenv ---------------------------------
|
||||
git clone -q --depth 1 --branch "$PYENV_GIT_TAG" https://github.com/pyenv/pyenv.git "$PYENV_ROOT"
|
||||
rm -rf "$PYENV_ROOT/.git"
|
||||
@@ -129,6 +156,10 @@ COREPACK_ENABLE_NETWORK=0 yarn --version
|
||||
COREPACK_ENABLE_NETWORK=0 pnpm --version
|
||||
wrangler --version
|
||||
prettier --version
|
||||
playwright --version
|
||||
firefox --version
|
||||
geckodriver --version
|
||||
chromium --version
|
||||
python3 --version
|
||||
pip --version
|
||||
virtualenv --version
|
||||
|
||||
Reference in New Issue
Block a user