2020-09-21 18:47:44 +03:00
|
|
|
FROM ubuntu:focal
|
|
|
|
|
2021-10-20 02:10:24 +03:00
|
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
|
|
ARG TZ=America/Los_Angeles
|
2022-03-26 00:45:53 +03:00
|
|
|
ARG DOCKER_IMAGE_NAME_TEMPLATE="mcr.microsoft.com/playwright:v%version%-focal"
|
2021-10-20 02:10:24 +03:00
|
|
|
|
2020-12-08 21:36:37 +03:00
|
|
|
# === INSTALL Node.js ===
|
|
|
|
|
2021-11-12 02:35:57 +03:00
|
|
|
RUN apt-get update && \
|
2022-11-14 22:30:36 +03:00
|
|
|
# Install node16
|
2022-07-25 13:49:51 +03:00
|
|
|
apt-get install -y curl wget gpg && \
|
2022-11-14 22:30:36 +03:00
|
|
|
curl -sL https://deb.nodesource.com/setup_16.x | bash - && \
|
2021-11-12 02:35:57 +03:00
|
|
|
apt-get install -y nodejs && \
|
|
|
|
# Feature-parity with node.js base images.
|
|
|
|
apt-get install -y --no-install-recommends git openssh-client && \
|
|
|
|
npm install -g yarn && \
|
|
|
|
# clean apt cache
|
|
|
|
rm -rf /var/lib/apt/lists/* && \
|
|
|
|
# Create the pwuser
|
|
|
|
adduser pwuser
|
2021-10-20 02:10:24 +03:00
|
|
|
|
2020-09-21 18:47:44 +03:00
|
|
|
# === BAKE BROWSERS INTO IMAGE ===
|
|
|
|
|
2021-02-12 05:33:30 +03:00
|
|
|
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
|
|
|
|
|
2020-09-21 18:47:44 +03:00
|
|
|
# 1. Add tip-of-tree Playwright package to install its browsers.
|
|
|
|
# The package should be built beforehand from tip-of-tree Playwright.
|
2021-10-11 17:52:17 +03:00
|
|
|
COPY ./playwright-core.tar.gz /tmp/playwright-core.tar.gz
|
2020-09-21 18:47:44 +03:00
|
|
|
|
2022-09-10 01:25:42 +03:00
|
|
|
# 2. Bake in Playwright Agent.
|
|
|
|
# Playwright Agent is used to bake in browsers and browser dependencies,
|
|
|
|
# and run docker server later on.
|
2021-10-20 02:10:24 +03:00
|
|
|
# Browsers will be downloaded in `/ms-playwright`.
|
2021-03-02 04:24:07 +03:00
|
|
|
# Note: make sure to set 777 to the registry so that any user can access
|
|
|
|
# registry.
|
2021-03-03 21:26:23 +03:00
|
|
|
RUN mkdir /ms-playwright && \
|
2021-10-20 02:10:24 +03:00
|
|
|
mkdir /ms-playwright-agent && \
|
|
|
|
cd /ms-playwright-agent && npm init -y && \
|
2021-10-11 17:52:17 +03:00
|
|
|
npm i /tmp/playwright-core.tar.gz && \
|
2022-03-26 00:45:53 +03:00
|
|
|
npx playwright mark-docker-image "${DOCKER_IMAGE_NAME_TEMPLATE}" && \
|
2021-11-12 02:35:57 +03:00
|
|
|
npx playwright install --with-deps && rm -rf /var/lib/apt/lists/* && \
|
2021-10-20 02:10:24 +03:00
|
|
|
rm /tmp/playwright-core.tar.gz && \
|
2021-03-02 04:24:07 +03:00
|
|
|
chmod -R 777 /ms-playwright
|