File: Dockerfile.noble

package info (click to toggle)
python-playwright 1.55.0%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,728 kB
  • sloc: python: 53,655; javascript: 383; sh: 216; makefile: 6
file content (55 lines) | stat: -rw-r--r-- 2,095 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
FROM ubuntu:noble

ARG DEBIAN_FRONTEND=noninteractive
ARG TZ=America/Los_Angeles
ARG DOCKER_IMAGE_NAME_TEMPLATE="mcr.microsoft.com/playwright/python:v%version%-noble"

ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8

# === INSTALL Python ===

RUN apt-get update && \
    # Install Python
    apt-get install -y python3 curl && \
    # Align with upstream Python image and don't be externally managed:
    # https://github.com/docker-library/python/issues/948
    rm /usr/lib/python3.12/EXTERNALLY-MANAGED && \
    update-alternatives --install /usr/bin/python python /usr/bin/python3 1 && \
    curl -sSL https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
    python get-pip.py && \
    rm get-pip.py && \
    # Feature-parity with node.js base images.
    apt-get install -y --no-install-recommends git openssh-client gpg && \
    # clean apt cache
    rm -rf /var/lib/apt/lists/* && \
    # Create the pwuser
    adduser pwuser

# === 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 ./dist/*-manylinux*.whl /tmp/

# 2. Bake in browsers & deps.
#    Browsers will be downloaded in `/ms-playwright`.
#    Note: make sure to set 777 to the registry so that any user can access
#    registry.
RUN mkdir /ms-playwright && \
    mkdir /ms-playwright-agent && \
    cd /ms-playwright-agent && \
    pip install virtualenv && \
    virtualenv venv && \
    . venv/bin/activate && \
    # if its amd64 then install the manylinux1_x86_64 pip package
    if [ "$(uname -m)" = "x86_64" ]; then pip install /tmp/*manylinux1_x86_64*.whl; fi && \
    # if its arm64 then install the manylinux1_aarch64 pip package
    if [ "$(uname -m)" = "aarch64" ]; then pip install /tmp/*manylinux_2_17_aarch64*.whl; fi && \
    playwright mark-docker-image "${DOCKER_IMAGE_NAME_TEMPLATE}" && \
    playwright install --with-deps && rm -rf /var/lib/apt/lists/* && \
    rm /tmp/*.whl && \
    rm -rf /ms-playwright-agent && \
    chmod -R 777 /ms-playwright