mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-14 21:53:35 +03:00
f637b0302d
Turns out Azure Pipelines is doing a few modifications to the base container. One of the important modification is that they add a new user to the container that has a passwordless sudo permissions. This user is used later on to run all the pipeline steps. This patch makes sure our shared registry inside the docker containers is accessible to all the users. Fixes #5635
96 lines
2.8 KiB
Docker
96 lines
2.8 KiB
Docker
FROM ubuntu:bionic
|
|
|
|
# === INSTALL BROWSER DEPENDENCIES ===
|
|
|
|
# Install WebKit dependencies
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
libwoff1 \
|
|
libopus0 \
|
|
libwebp6 \
|
|
libwebpdemux2 \
|
|
libenchant1c2a \
|
|
libgudev-1.0-0 \
|
|
libsecret-1-0 \
|
|
libhyphen0 \
|
|
libgdk-pixbuf2.0-0 \
|
|
libegl1 \
|
|
libnotify4 \
|
|
libxslt1.1 \
|
|
libevent-2.1-6 \
|
|
libgles2 \
|
|
libvpx5 \
|
|
libxcomposite1 \
|
|
libatk1.0-0 \
|
|
libatk-bridge2.0-0 \
|
|
libepoxy0 \
|
|
libgtk-3-0 \
|
|
libharfbuzz-icu0
|
|
|
|
# Install gstreamer and plugins to support video playback in WebKit.
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
libgstreamer-gl1.0-0 \
|
|
libgstreamer-plugins-bad1.0-0 \
|
|
gstreamer1.0-plugins-good \
|
|
gstreamer1.0-libav
|
|
|
|
# Install Chromium dependencies
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
fonts-liberation \
|
|
libnss3 \
|
|
libxss1 \
|
|
libasound2 \
|
|
fonts-noto-color-emoji \
|
|
libxtst6
|
|
|
|
# Install Firefox dependencies
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
libdbus-glib-1-2 \
|
|
libxt6
|
|
|
|
# Install ffmpeg to bring in audio and video codecs necessary for playing videos in Firefox.
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
ffmpeg
|
|
|
|
# (Optional) Install XVFB if there's a need to run browsers in headful mode
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
xvfb
|
|
|
|
# === INSTALL Node.js ===
|
|
|
|
# Install node14
|
|
RUN apt-get update && apt-get install -y curl && \
|
|
curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
|
|
apt-get install -y nodejs
|
|
|
|
# Feature-parity with node.js base images.
|
|
RUN apt-get update && apt-get install -y --no-install-recommends git ssh && \
|
|
npm install -g yarn
|
|
|
|
# Create the pwuser (we internally create a symlink for the pwuser and the root user)
|
|
RUN adduser pwuser
|
|
|
|
# Install Python 3.8
|
|
|
|
RUN apt-get update && apt-get install -y python3.8 python3-pip && \
|
|
update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 && \
|
|
update-alternatives --install /usr/bin/python python /usr/bin/python3 1
|
|
|
|
# === BAKE BROWSERS INTO IMAGE ===
|
|
|
|
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
|
|
|
|
# 1. Add tip-of-tree Playwright package to install its browsers.
|
|
# The package should be built beforehand from tip-of-tree Playwright.
|
|
COPY ./playwright.tar.gz /tmp/playwright.tar.gz
|
|
|
|
# 2. Install playwright and then delete the installation.
|
|
# Browsers will remain downloaded in `/ms-playwright`.
|
|
# Note: make sure to set 777 to the registry so that any user can access
|
|
# registry.
|
|
RUN mdkir /ms-playwright && \
|
|
mkdir /tmp/pw && cd /tmp/pw && npm init -y && \
|
|
npm i /tmp/playwright.tar.gz && \
|
|
rm -rf /tmp/pw && rm /tmp/playwright.tar.gz && \
|
|
chmod -R 777 /ms-playwright
|
|
|