mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-11 05:20:36 +08:00
60 lines
2.5 KiB
Docker
60 lines
2.5 KiB
Docker
# Runs the Playwright e2e suite in a Playwright-supported Linux distro.
|
|
# Useful when the host OS is too new/old for Playwright's browser builds.
|
|
#
|
|
# Two stages:
|
|
# base - Node + Chromium; runs the suite against the released radicle-httpd.
|
|
# local - base + a Rust toolchain; additionally compiles radicle-httpd from
|
|
# source for `--local` runs (needed when testing backend changes).
|
|
#
|
|
# Chromium and its OS dependencies are baked in at the project's pinned
|
|
# Playwright version. node_modules and the repo are provided at runtime via
|
|
# bind mount + named volume (see docker-compose.e2e.yml).
|
|
FROM node:24-bookworm AS base
|
|
|
|
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright \
|
|
DEBIAN_FRONTEND=noninteractive
|
|
|
|
# xz-utils: install-binaries unpacks .tar.xz release archives.
|
|
# git/curl/ca-certificates: fetching binaries and git operations in fixtures.
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends \
|
|
xz-utils ca-certificates git curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /work
|
|
|
|
# Install Chromium plus its apt-level runtime dependencies, pinned to the
|
|
# Playwright version in package-lock.json so the baked browser matches the
|
|
# @playwright/test that npm ci installs into the volume at runtime. Copying
|
|
# only the npm manifests keeps this layer cached across source changes. The
|
|
# build context is the repository root, which holds the npm workspace: npm ci
|
|
# checks the lockfile against every workspace's package.json, even when it
|
|
# installs only explorer.
|
|
# --ignore-scripts: this layer only warms the browser cache, so dependency
|
|
# install scripts are not necessary.
|
|
COPY package.json package-lock.json .npmrc ./
|
|
COPY shared/ui/package.json shared/ui/
|
|
COPY explorer/package.json explorer/
|
|
COPY desktop/package.json desktop/
|
|
RUN npm ci -w explorer --ignore-scripts \
|
|
&& npx playwright install --with-deps chromium \
|
|
&& rm -rf node_modules explorer/node_modules
|
|
|
|
ENTRYPOINT ["/work/explorer/scripts/docker-e2e-entrypoint.sh"]
|
|
|
|
# --- local stage: adds Rust so the entrypoint can build radicle-httpd ---
|
|
FROM base AS local
|
|
|
|
# Toolchain + build deps for compiling radicle-httpd (debug build).
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends \
|
|
build-essential pkg-config libssl-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
ENV RUSTUP_HOME=/usr/local/rustup \
|
|
CARGO_HOME=/usr/local/cargo \
|
|
PATH=/usr/local/cargo/bin:$PATH
|
|
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
|
|
| sh -s -- -y --no-modify-path --profile minimal --default-toolchain stable \
|
|
&& rustc --version
|