Add browsers for tests: Playwright, Firefox, geckodriver, headless Chrome (closes #10)
Firefox comes from Mozilla's own apt repo, pinned above Ubuntu's snap-only package. geckodriver is at its latest release, independent of the Firefox version. Playwright installs its Chromium and Firefox; WebKit is skipped because no repository uses it today. 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_DOWNLOAD_PROMPT=0 \
|
||||||
COREPACK_ENABLE_AUTO_PIN=0 \
|
COREPACK_ENABLE_AUTO_PIN=0 \
|
||||||
PYENV_ROOT=/usr/local/pyenv \
|
PYENV_ROOT=/usr/local/pyenv \
|
||||||
|
PLAYWRIGHT_BROWSERS_PATH=/ms-playwright \
|
||||||
GOPATH=/root/go \
|
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
|
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` |
|
| yarn, pnpm | corepack, cache pre-populated | `/usr/local/corepack` |
|
||||||
| wrangler | `npm install -g wrangler` | nvm LTS global bin |
|
| wrangler | `npm install -g wrangler` | nvm LTS global bin |
|
||||||
| prettier | `npm install -g prettier` | 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` |
|
| Python (distro) | apt `python3`, `pip`, `venv` | `/usr/bin/python3` |
|
||||||
| pyenv | git tag | `/usr/local/pyenv` |
|
| pyenv | git tag | `/usr/local/pyenv` |
|
||||||
| Python (latest) | `pyenv install` | `/usr/local/pyenv/versions/*` |
|
| 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`,
|
Environment variables set in the image: `NVM_DIR`, `NVM_SYMLINK_CURRENT`,
|
||||||
`COREPACK_HOME`, `COREPACK_ENABLE_DOWNLOAD_PROMPT=0`,
|
`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
|
### Yarn and corepack
|
||||||
|
|
||||||
@@ -91,9 +97,18 @@ the `Dockerfile`:
|
|||||||
| `NVM_GIT_TAG` | `nvm-sh/nvm` release tag |
|
| `NVM_GIT_TAG` | `nvm-sh/nvm` release tag |
|
||||||
| `PYENV_GIT_TAG` | `pyenv/pyenv` release tag |
|
| `PYENV_GIT_TAG` | `pyenv/pyenv` release tag |
|
||||||
|
|
||||||
Everything else resolves to its current release at build time: Ubuntu
|
Everything else resolves to its current release at build time:
|
||||||
packages, Go, Node LTS, Python, Hugo, golangci-lint, npm, yarn, pnpm,
|
|
||||||
wrangler.
|
- Ubuntu packages
|
||||||
|
- Go, Node LTS, and Python
|
||||||
|
- Hugo and golangci-lint
|
||||||
|
- npm, yarn, pnpm, wrangler, and prettier
|
||||||
|
- Playwright and its browsers
|
||||||
|
- Firefox and geckodriver
|
||||||
|
|
||||||
|
Playwright installs its browsers for the image's Playwright version only. A
|
||||||
|
child image that pins a different Playwright version downloads its own
|
||||||
|
browsers.
|
||||||
|
|
||||||
## Services and init
|
## Services and init
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,10 @@ docker run --rm "$img" bash -ec '
|
|||||||
valkey-cli shutdown nosave
|
valkey-cli shutdown nosave
|
||||||
psql --version
|
psql --version
|
||||||
postgres --version
|
postgres --version
|
||||||
|
playwright --version
|
||||||
|
firefox --version
|
||||||
|
geckodriver --version
|
||||||
|
chromium --version
|
||||||
'
|
'
|
||||||
|
|
||||||
echo "== $img: runit service lifecycle"
|
echo "== $img: runit service lifecycle"
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ nvm install --lts
|
|||||||
nvm alias default "lts/*"
|
nvm alias default "lts/*"
|
||||||
nvm use default
|
nvm use default
|
||||||
set -ux
|
set -ux
|
||||||
npm install -g npm@latest corepack wrangler prettier
|
npm install -g npm@latest corepack wrangler prettier playwright
|
||||||
corepack enable
|
corepack enable
|
||||||
# Pre-populate the corepack cache so projects that pin a package manager
|
# 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.
|
# do not download at run time. The last yarn installed becomes the default.
|
||||||
@@ -90,6 +90,42 @@ pnpm --version
|
|||||||
yarn --version
|
yarn --version
|
||||||
nvm cache clear
|
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
|
||||||
|
cat > /etc/apt/preferences.d/mozilla <<'EOF'
|
||||||
|
Package: *
|
||||||
|
Pin: origin packages.mozilla.org
|
||||||
|
Pin-Priority: 1000
|
||||||
|
EOF
|
||||||
|
apt-get update
|
||||||
|
apt-get -y install --no-install-recommends -t mozilla firefox
|
||||||
|
|
||||||
|
# geckodriver, at its latest release (independent of the Firefox version).
|
||||||
|
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 is skipped because no repository
|
||||||
|
# uses it today. Playwright's Chromium is also the headless Chrome for
|
||||||
|
# chromedp-style clients, exposed as `chromium` on PATH.
|
||||||
|
playwright install --with-deps chromium firefox
|
||||||
|
chromiums=( "$PLAYWRIGHT_BROWSERS_PATH"/chromium-*/chrome-linux*/chrome )
|
||||||
|
if [ "${#chromiums[@]}" -ne 1 ] || [ ! -x "${chromiums[0]}" ]; then
|
||||||
|
echo "error: expected exactly one chromium binary, found ${#chromiums[@]}" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
ln -s "${chromiums[0]}" /usr/local/bin/chromium
|
||||||
|
|
||||||
# --- pyenv, Python (latest), pip, virtualenv ---------------------------------
|
# --- pyenv, Python (latest), pip, virtualenv ---------------------------------
|
||||||
git clone -q --depth 1 --branch "$PYENV_GIT_TAG" https://github.com/pyenv/pyenv.git "$PYENV_ROOT"
|
git clone -q --depth 1 --branch "$PYENV_GIT_TAG" https://github.com/pyenv/pyenv.git "$PYENV_ROOT"
|
||||||
rm -rf "$PYENV_ROOT/.git"
|
rm -rf "$PYENV_ROOT/.git"
|
||||||
@@ -141,6 +177,10 @@ COREPACK_ENABLE_NETWORK=0 yarn --version
|
|||||||
COREPACK_ENABLE_NETWORK=0 pnpm --version
|
COREPACK_ENABLE_NETWORK=0 pnpm --version
|
||||||
wrangler --version
|
wrangler --version
|
||||||
prettier --version
|
prettier --version
|
||||||
|
playwright --version
|
||||||
|
firefox --version
|
||||||
|
geckodriver --version
|
||||||
|
chromium --version
|
||||||
python3 --version
|
python3 --version
|
||||||
pip --version
|
pip --version
|
||||||
virtualenv --version
|
virtualenv --version
|
||||||
|
|||||||
Reference in New Issue
Block a user