2026-06-17 11:20:33 +01:00
|
|
|
# Expose the argument for use in FROM
|
2026-03-03 12:40:41 +00:00
|
|
|
ARG PLAYWRIGHT_VERSION
|
2026-05-13 14:07:16 +01:00
|
|
|
FROM mcr.microsoft.com/playwright:v${PLAYWRIGHT_VERSION}-noble
|
2026-06-17 11:20:33 +01:00
|
|
|
# Expose the argument to this build stage
|
|
|
|
|
ARG PLAYWRIGHT_VERSION
|
2026-02-13 10:20:16 +00:00
|
|
|
|
|
|
|
|
WORKDIR /work
|
|
|
|
|
|
|
|
|
|
# fonts-dejavu is needed for the same RTL rendering as on CI
|
2026-04-21 10:58:16 +01:00
|
|
|
RUN apt-get update && \
|
|
|
|
|
apt-get -y install docker.io fonts-dejavu && \
|
|
|
|
|
apt-get purge -y --auto-remove && \
|
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
2026-02-13 10:20:16 +00:00
|
|
|
# Install the matching playwright runtime, the docker image only includes browsers
|
|
|
|
|
RUN npm i -g playwright@${PLAYWRIGHT_VERSION}
|
|
|
|
|
|
2026-04-21 10:58:16 +01:00
|
|
|
# switch to pwuser
|
|
|
|
|
USER 1001:1001
|
|
|
|
|
|
2026-02-13 10:20:16 +00:00
|
|
|
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
|
|
|
|
|
2026-04-10 13:31:03 +01:00
|
|
|
# We use `docker-init` as PID 1, which means that the container shuts down correctly on SIGTERM.
|
|
|
|
|
#
|
|
|
|
|
# (The problem is that PID 1 doesn't get default signal handlers, and
|
|
|
|
|
# playwright server doesn't register a SIGTERM handler, so if that ends up as
|
|
|
|
|
# PID 1, then it ignores SIGTERM. Likewise bash doesn't set a SIGTERM handler by default.
|
|
|
|
|
#
|
|
|
|
|
# The easiest solution is to use docker-init, which is in fact `tini` (https://github.com/krallin/tini).
|
|
|
|
|
#
|
|
|
|
|
# See https://github.com/krallin/tini/issues/8#issuecomment-146135930 for a good explanation of all this.)
|
|
|
|
|
ENTRYPOINT ["/usr/bin/docker-init", "/docker-entrypoint.sh"]
|