FROM mcr.microsoft.com/dotnet/sdk:10.0-resolute ARG DEBIAN_FRONTEND=noninteractive ARG TZ=America/Los_Angeles ARG DOCKER_IMAGE_NAME_TEMPLATE="mcr.microsoft.com/playwright/dotnet:v%version%-resolute" ARG UBUNTU_MIRROR_PREFIX ENV LANG=C.UTF-8 ENV LC_ALL=C.UTF-8 # === INSTALL dependencies === RUN find /etc/apt -type f \( -name '*.list' -o -name '*.sources' \) \ -exec sed -i "s|http://archive.ubuntu.com|http://${UBUNTU_MIRROR_PREFIX}archive.ubuntu.com|g; s|http://ports.ubuntu.com|http://${UBUNTU_MIRROR_PREFIX}ports.ubuntu.com|g" {} + && \ apt-get update && \ # Feature-parity with node.js base images. apt-get install -y --no-install-recommends git openssh-client curl gpg && \ # clean apt cache rm -rf /var/lib/apt/lists/* && \ # Create the pwuser useradd -m -s /bin/bash 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/ /tmp/playwright-dotnet # 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 && \ /tmp/playwright-dotnet/playwright.ps1 install --with-deps && \ /tmp/playwright-dotnet/playwright.ps1 mark-docker-image "${DOCKER_IMAGE_NAME_TEMPLATE}" && \ rm -rf /var/lib/apt/lists/* && \ rm -rf /tmp/* && \ chmod -R 777 /ms-playwright