Files
AutistMask/tests/e2e/firefox/Dockerfile
clawbot 7cff69b35f
All checks were successful
check / check (push) Successful in 52s
e2e / e2e-chrome (push) Successful in 1m54s
e2e / e2e-firefox (push) Successful in 1m3s
wip: e2e in ci
2026-08-12 11:54:38 +00:00

80 lines
3.3 KiB
Docker

# Firefox end-to-end image: stock Firefox plus geckodriver on a node base,
# with this repo and a freshly built extension inside it, built by
# script/test-e2e-firefox. The harness itself has no dependencies, so
# nothing is installed for it.
#
# The build context is the repo root. The repo is baked in rather than
# bind-mounted because a bind mount does not resolve under Gitea Actions:
# the runner executes the job inside a container against the host's docker
# socket, so the source side of a -v is resolved by the host daemon, and
# the job's checkout lives on a docker volume that is not a host path. A
# build context is streamed to the daemon and therefore works from
# anywhere. Building the extension here as well means the machine starting
# the run needs nothing but docker — and it is the only way this suite can
# have both a built extension and the `--network none` it runs under, since
# a container with no network cannot install anything.
#
# The three external artifacts are all pinned by digest and are fetched in
# layers that no repo change touches, so editing the harness or any source
# file re-runs only the two cheap layers at the bottom.
#
# The Firefox version in particular must not float:
# -remote-allow-system-access is mandatory on 153 and was not on 142, so
# the flag the harness passes is version-coupled.
# node:22-bookworm-slim, 2026-08-12
FROM node@sha256:d649c27dae7ba0137b3cef5dd75baa422c08dc3d9e3fc0c23dfb172dc3cc6436
ENV DEBIAN_FRONTEND=noninteractive
# Firefox's shared-library dependencies on a slim base, plus the two tools
# needed to fetch and unpack the pinned tarballs.
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
libasound2 \
libdbus-glib-1-2 \
libgtk-3-0 \
libx11-xcb1 \
libxt6 \
libxtst6 \
xz-utils \
&& rm -rf /var/lib/apt/lists/*
# Firefox 153.0.3, linux-x86_64, en-US
ARG FIREFOX_URL=https://ftp.mozilla.org/pub/firefox/releases/153.0.3/linux-x86_64/en-US/firefox-153.0.3.tar.xz
ARG FIREFOX_SHA256=22b312280900bfb174b685ece32c7b3c6d72e7f8e53d6d30f21ac41a8dc500a2
RUN curl -fsSL -o /tmp/firefox.tar.xz "$FIREFOX_URL" \
&& echo "$FIREFOX_SHA256 /tmp/firefox.tar.xz" | sha256sum -c - \
&& tar -xJf /tmp/firefox.tar.xz -C /opt \
&& rm /tmp/firefox.tar.xz \
&& /opt/firefox/firefox --version
# geckodriver v0.36.0, linux64
ARG GECKODRIVER_URL=https://github.com/mozilla/geckodriver/releases/download/v0.36.0/geckodriver-v0.36.0-linux64.tar.gz
ARG GECKODRIVER_SHA256=0bde38707eb0a686a20c6bd50f4adcc7d60d4f73c60eb83ee9e0db8f65823e04
RUN curl -fsSL -o /tmp/geckodriver.tar.gz "$GECKODRIVER_URL" \
&& echo "$GECKODRIVER_SHA256 /tmp/geckodriver.tar.gz" | sha256sum -c - \
&& tar -xzf /tmp/geckodriver.tar.gz -C /usr/local/bin \
&& rm /tmp/geckodriver.tar.gz \
&& geckodriver --version
ENV FIREFOX_BIN=/opt/firefox/firefox
ENV GECKODRIVER=/usr/local/bin/geckodriver
WORKDIR /work
# Same layering as the root Dockerfile: script/bootstrap installs the
# prerequisites and the dependencies, and the manifests are copied first so
# that layer is cached until they change.
COPY script/ script/
COPY package.json yarn.lock ./
RUN script/bootstrap
COPY . .
RUN make build
CMD ["node", "tests/e2e/firefox/run.js", "dist/firefox"]