|
| 1 | +FROM ubuntu:bionic |
| 2 | + |
| 3 | +ARG DEBIAN_FRONTEND=noninteractive |
| 4 | +ARG TZ=America/Los_Angeles |
| 5 | + |
| 6 | +# === INSTALL Python === |
| 7 | + |
| 8 | +RUN apt-get update && \ |
| 9 | + # Install Python |
| 10 | + apt-get install -y python3 python3-distutils curl && \ |
| 11 | + update-alternatives --install /usr/bin/python python /usr/bin/python3 1 && \ |
| 12 | + curl -sSL https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \ |
| 13 | + python get-pip.py && \ |
| 14 | + rm get-pip.py && \ |
| 15 | + # Feature-parity with node.js base images. |
| 16 | + apt-get install -y --no-install-recommends git openssh-client && \ |
| 17 | + # clean apt cache |
| 18 | + rm -rf /var/lib/apt/lists/* && \ |
| 19 | + # Create the pwuser |
| 20 | + adduser pwuser |
| 21 | + |
| 22 | +# === BAKE BROWSERS INTO IMAGE === |
| 23 | + |
| 24 | +ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright |
| 25 | + |
| 26 | +# 1. Add tip-of-tree Playwright package to install its browsers. |
| 27 | +# The package should be built beforehand from tip-of-tree Playwright. |
| 28 | +COPY ./dist/*-manylinux*.whl /tmp/ |
| 29 | + |
| 30 | +# 2. Bake in browsers & deps. |
| 31 | +# Browsers will be downloaded in `/ms-playwright`. |
| 32 | +# Note: make sure to set 777 to the registry so that any user can access |
| 33 | +# registry. |
| 34 | +RUN mkdir /ms-playwright && \ |
| 35 | + mkdir /ms-playwright-agent && \ |
| 36 | + cd /ms-playwright-agent && \ |
| 37 | + # if its amd64 then install the manylinux1_x86_64 pip package |
| 38 | + if [ "$(uname -m)" = "x86_64" ]; then pip install /tmp/*manylinux1_x86_64*.whl; fi && \ |
| 39 | + # if its arm64 then install the manylinux1_aarch64 pip package |
| 40 | + if [ "$(uname -m)" = "aarch64" ]; then pip install /tmp/*manylinux_2_17_aarch64*.whl; fi && \ |
| 41 | + playwright install --with-deps && rm -rf /var/lib/apt/lists/* && \ |
| 42 | + rm /tmp/*.whl && \ |
| 43 | + rm -rf /ms-playwright-agent && \ |
| 44 | + chmod -R 777 /ms-playwright |
0 commit comments