diff --git a/browser_patches/docker/cli.sh b/browser_patches/docker/cli.sh new file mode 100755 index 0000000000..b265dcd16a --- /dev/null +++ b/browser_patches/docker/cli.sh @@ -0,0 +1,96 @@ +#!/bin/bash +# This script is designed to build Firefox & WebKit on various Linux +# distributions inside docker containers. +set -e +set +x +set -o pipefail + +if [[ ($1 == '--help') || ($1 == '-h') ]]; then + echo "usage: $(basename "$0") [webkit-ubuntu-20.04|firefox-debian-11|...] [build|test|compile|enter|stop]" + echo + echo "Builds Webkit or Firefox browser inside given Linux distribution" + exit 0 +fi + +trap "cd $(pwd -P)" EXIT +cd "$(dirname "$0")" +SCRIPT_FOLDER="$(pwd -P)" + +export BUILD_FLAVOR="${1}" +export BROWSER_NAME="" + +DOCKERFILE="" + +if [[ "${BUILD_FLAVOR}" == "firefox-beta-"* ]]; then + DOCKERFILE="${SCRIPT_FOLDER}/firefox-beta/${BUILD_FLAVOR#firefox-beta-}.dockerfile" + BROWSER_NAME="firefox-beta" +elif [[ "${BUILD_FLAVOR}" == "firefox-"* ]]; then + DOCKERFILE="${SCRIPT_FOLDER}/firefox/${BUILD_FLAVOR#firefox-}.dockerfile" + BROWSER_NAME="firefox" +elif [[ "${BUILD_FLAVOR}" == "webkit-"* ]]; then + DOCKERFILE="${SCRIPT_FOLDER}/webkit/${BUILD_FLAVOR#webkit-}.dockerfile" + BROWSER_NAME="webkit" +else + echo "ERROR: unknown build flavor - ${BUILD_FLAVOR}" + exit 1 +fi + +if [[ "${BUILD_FLAVOR}" == *"-arm64" ]]; then + EXPECTED_ARCH="arm64" + DOCKER_PLATFORM="linux/arm64" +else + EXPECTED_ARCH="x86_64" + DOCKER_PLATFORM="linux/amd64" +fi + +if [[ $(arch) != "${EXPECTED_ARCH}" ]]; then + echo "ERROR: host architecture $(arch) does not match expected architecture - ${EXPECTED_ARCH}" + exit 1 +fi + +DOCKER_IMAGE_NAME="${BUILD_FLAVOR}" +DOCKER_CONTAINER_NAME="${BUILD_FLAVOR}" +DOCKER_ARGS=$(echo \ + --env CI \ + --env BUILD_FLAVOR \ + --env BROWSER_NAME \ + --env TELEGRAM_BOT_KEY \ + --env AZ_ACCOUNT_NAME \ + --env AZ_ACCOUNT_KEY \ + --env GITHUB_SERVER_URL \ + --env GITHUB_REPOSITORY \ + --env GITHUB_RUN_ID \ + --env GH_TOKEN \ + --env DEBIAN_FRONTEND=noninteractive \ + --env TZ="America/Los_Angeles" +) + +if [[ "$2" == "build" ]]; then + docker build \ + --build-arg ARG_BUILD_FLAVOR="${BUILD_FLAVOR}" \ + --build-arg ARG_BROWSER_NAME="${BROWSER_NAME}" \ + --no-cache \ + --platform "${DOCKER_PLATFORM}" \ + -t "${DOCKER_IMAGE_NAME}" \ + -f "${DOCKERFILE}" . +elif [[ "$2" == "test" ]]; then + docker run --rm ${DOCKER_ARGS} --init --name "${DOCKER_CONTAINER_NAME}" --platform "${DOCKER_PLATFORM}" -it "${DOCKER_IMAGE_NAME}" /bin/bash -c ' + CI=1 ./browser_patches/prepare_checkout.sh "${BROWSER_NAME}" + ./browser_patches/build.sh "${BROWSER_NAME}" --full + ./browser_patches/${BROWSER_NAME}/archive.sh $PWD/archive.zip + ' +elif [[ "$2" == "compile" ]]; then + docker run --rm ${DOCKER_ARGS} --init --name "${DOCKER_CONTAINER_NAME}" --platform "${DOCKER_PLATFORM}" -it "${DOCKER_IMAGE_NAME}" /bin/bash -c ' + ./browser_patches/checkout_build_archive_upload.sh "${BUILD_FLAVOR}" + ' +elif [[ "$2" == "enter" ]]; then + docker run --rm ${DOCKER_ARGS} --init --name "${DOCKER_CONTAINER_NAME}" --platform "${DOCKER_PLATFORM}" -it "${DOCKER_IMAGE_NAME}" /bin/bash +elif [[ "$2" == "kill" || "$2" == "stop" ]]; then + docker kill "${DOCKER_CONTAINER_NAME}" + # Wait for container to stop + docker wait "${DOCKER_CONTAINER_NAME}" || true +else + echo "ERROR: unknown command - $2" + exit 1 +fi + diff --git a/browser_patches/docker/firefox-beta/debian-11.dockerfile b/browser_patches/docker/firefox-beta/debian-11.dockerfile new file mode 100644 index 0000000000..034db787a7 --- /dev/null +++ b/browser_patches/docker/firefox-beta/debian-11.dockerfile @@ -0,0 +1,53 @@ +FROM --platform=linux/amd64 debian:11 + +# Reexport --build-arg as environment variables +ARG ARG_BUILD_FLAVOR +ARG ARG_BROWSER_NAME +ENV BUILD_FLAVOR="${ARG_BUILD_FLAVOR}" +ENV BROWSER_NAME="${ARG_BROWSER_NAME}" + +# These are needed to auto-install tzdata. See https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image +ARG DEBIAN_FRONTEND=noninteractive +ARG TZ=America/Los_Angeles + +RUN apt-get update && apt-get install -y curl \ + build-essential \ + git-core \ + zip unzip \ + tzdata \ + sudo +# Install Python3 with distutils +RUN apt-get install -y python3 python3-dev python3-pip python3-distutils + +# Install Azure CLI +RUN curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash + +# Install node16 +RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs + +# Create the pwuser and make it passwordless sudoer. +RUN adduser --disabled-password --gecos "" pwuser && \ + echo "ALL ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers + +# mitigate git clone issues on CI +# See https://stdworkflow.com/877/error-rpc-failed-curl-56-gnutls-recv-error-54-error-in-the-pull-function +RUN git config --system user.email "devops@playwright.dev" && \ + git config --system user.name "Playwright DevOps" && \ + git config --system http.postBuffer 524288000 && \ + git config --system http.lowSpeedLimit 0 && \ + git config --system http.lowSpeedTime 999999 + +# Show welcome message to pwuser +COPY --chown=pwuser ./pwuser_bashrc /home/pwuser/.bashrc + +USER pwuser + +# Install Rust +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +ENV PATH="${PATH}:/home/pwuser/.cargo/bin" + +RUN cd /home/pwuser && git clone --depth=1 https://github.com/microsoft/playwright + +WORKDIR /home/pwuser/playwright + + diff --git a/browser_patches/docker/firefox-beta/ubuntu-18.04.dockerfile b/browser_patches/docker/firefox-beta/ubuntu-18.04.dockerfile new file mode 100644 index 0000000000..2ff837ead5 --- /dev/null +++ b/browser_patches/docker/firefox-beta/ubuntu-18.04.dockerfile @@ -0,0 +1,59 @@ +FROM --platform=linux/amd64 ubuntu:18.04 + +# Reexport --build-arg as environment variables +ARG ARG_BUILD_FLAVOR +ARG ARG_BROWSER_NAME +ENV BUILD_FLAVOR="${ARG_BUILD_FLAVOR}" +ENV BROWSER_NAME="${ARG_BROWSER_NAME}" + +# These are needed to auto-install tzdata. See https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image +ARG DEBIAN_FRONTEND=noninteractive +ARG TZ=America/Los_Angeles + +RUN apt-get update && apt-get install -y curl \ + build-essential \ + git-core \ + zip unzip \ + tzdata \ + sudo +# Install Python3 with distutils +# Firefox build on Ubuntu 18.04 requires Python3.8 to run its build scripts. +RUN apt-get install -y python3.8 python3.8-dev python3.8-distutils && \ + # Point python3 to python3.8 + update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2 && \ + curl -sSL https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \ + python3 get-pip.py && \ + rm get-pip.py + +# Install Azure CLI +RUN curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash + +# Install node16 +RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs + +# Create the pwuser and make it passwordless sudoer. +RUN adduser --disabled-password --gecos "" pwuser && \ + echo "ALL ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers + +# mitigate git clone issues on CI +# See https://stdworkflow.com/877/error-rpc-failed-curl-56-gnutls-recv-error-54-error-in-the-pull-function +RUN git config --system user.email "devops@playwright.dev" && \ + git config --system user.name "Playwright DevOps" && \ + git config --system http.postBuffer 524288000 && \ + git config --system http.lowSpeedLimit 0 && \ + git config --system http.lowSpeedTime 999999 + +# Show welcome message to pwuser +COPY --chown=pwuser ./pwuser_bashrc /home/pwuser/.bashrc + +USER pwuser + +# Install Rust +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +ENV PATH="${PATH}:/home/pwuser/.cargo/bin" + +RUN cd /home/pwuser && git clone --depth=1 https://github.com/microsoft/playwright + +WORKDIR /home/pwuser/playwright + + diff --git a/browser_patches/docker/firefox-beta/ubuntu-20.04-arm64.dockerfile b/browser_patches/docker/firefox-beta/ubuntu-20.04-arm64.dockerfile new file mode 100644 index 0000000000..fd977444fe --- /dev/null +++ b/browser_patches/docker/firefox-beta/ubuntu-20.04-arm64.dockerfile @@ -0,0 +1,61 @@ +FROM --platform=linux/arm64 ubuntu:20.04 + +# Reexport --build-arg as environment variables +ARG ARG_BUILD_FLAVOR +ARG ARG_BROWSER_NAME +ENV BUILD_FLAVOR="${ARG_BUILD_FLAVOR}" +ENV BROWSER_NAME="${ARG_BROWSER_NAME}" + +# These are needed to auto-install tzdata. See https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image +ARG DEBIAN_FRONTEND=noninteractive +ARG TZ=America/Los_Angeles + +RUN apt-get update && apt-get install -y curl \ + build-essential \ + git-core \ + zip unzip \ + tzdata \ + sudo + +# Ubuntu 20.04 aarch64 specific: default to clang-12. +RUN apt-get install -y clang-12 +ENV CC=/usr/bin/clang-12 +ENV CXX=/usr/bin/clang++-12 + +# Install Python3 with distutils +RUN apt-get install -y python3 python3-dev python3-pip python3-distutils + +# Install AZ CLI with Python since they do not ship +# aarch64 to APT: https://github.com/Azure/azure-cli/issues/7368 +# Pin so future releases do not break us. +RUN pip3 install azure-cli==2.38.0 + +# Install node16 +RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs + +# Create the pwuser and make it passwordless sudoer. +RUN adduser --disabled-password --gecos "" pwuser && \ + echo "ALL ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers + +# mitigate git clone issues on CI +# See https://stdworkflow.com/877/error-rpc-failed-curl-56-gnutls-recv-error-54-error-in-the-pull-function +RUN git config --system user.email "devops@playwright.dev" && \ + git config --system user.name "Playwright DevOps" && \ + git config --system http.postBuffer 524288000 && \ + git config --system http.lowSpeedLimit 0 && \ + git config --system http.lowSpeedTime 999999 + +# Show welcome message to pwuser +COPY --chown=pwuser ./pwuser_bashrc /home/pwuser/.bashrc + +USER pwuser + +# Install Rust +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +ENV PATH="${PATH}:/home/pwuser/.cargo/bin" + +RUN cd /home/pwuser && git clone --depth=1 https://github.com/microsoft/playwright + +WORKDIR /home/pwuser/playwright + + diff --git a/browser_patches/docker/firefox-beta/ubuntu-20.04.dockerfile b/browser_patches/docker/firefox-beta/ubuntu-20.04.dockerfile new file mode 100644 index 0000000000..c964549910 --- /dev/null +++ b/browser_patches/docker/firefox-beta/ubuntu-20.04.dockerfile @@ -0,0 +1,53 @@ +FROM --platform=linux/amd64 ubuntu:20.04 + +# Reexport --build-arg as environment variables +ARG ARG_BUILD_FLAVOR +ARG ARG_BROWSER_NAME +ENV BUILD_FLAVOR="${ARG_BUILD_FLAVOR}" +ENV BROWSER_NAME="${ARG_BROWSER_NAME}" + +# These are needed to auto-install tzdata. See https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image +ARG DEBIAN_FRONTEND=noninteractive +ARG TZ=America/Los_Angeles + +RUN apt-get update && apt-get install -y curl \ + build-essential \ + git-core \ + zip unzip \ + tzdata \ + sudo +# Install Python3 with distutils +RUN apt-get install -y python3 python3-dev python3-pip python3-distutils + +# Install Azure CLI +RUN curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash + +# Install node16 +RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs + +# Create the pwuser and make it passwordless sudoer. +RUN adduser --disabled-password --gecos "" pwuser && \ + echo "ALL ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers + +# mitigate git clone issues on CI +# See https://stdworkflow.com/877/error-rpc-failed-curl-56-gnutls-recv-error-54-error-in-the-pull-function +RUN git config --system user.email "devops@playwright.dev" && \ + git config --system user.name "Playwright DevOps" && \ + git config --system http.postBuffer 524288000 && \ + git config --system http.lowSpeedLimit 0 && \ + git config --system http.lowSpeedTime 999999 + +# Show welcome message to pwuser +COPY --chown=pwuser ./pwuser_bashrc /home/pwuser/.bashrc + +USER pwuser + +# Install Rust +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +ENV PATH="${PATH}:/home/pwuser/.cargo/bin" + +RUN cd /home/pwuser && git clone --depth=1 https://github.com/microsoft/playwright + +WORKDIR /home/pwuser/playwright + + diff --git a/browser_patches/docker/firefox-beta/ubuntu-22.04-arm64.dockerfile b/browser_patches/docker/firefox-beta/ubuntu-22.04-arm64.dockerfile new file mode 100644 index 0000000000..71e00ace7c --- /dev/null +++ b/browser_patches/docker/firefox-beta/ubuntu-22.04-arm64.dockerfile @@ -0,0 +1,61 @@ +FROM --platform=linux/arm64 ubuntu:22.04 + +# Reexport --build-arg as environment variables +ARG ARG_BUILD_FLAVOR +ARG ARG_BROWSER_NAME +ENV BUILD_FLAVOR="${ARG_BUILD_FLAVOR}" +ENV BROWSER_NAME="${ARG_BROWSER_NAME}" + +# These are needed to auto-install tzdata. See https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image +ARG DEBIAN_FRONTEND=noninteractive +ARG TZ=America/Los_Angeles + +RUN apt-get update && apt-get install -y curl \ + build-essential \ + git-core \ + zip unzip \ + tzdata \ + sudo + +# Ubuntu 22.04 aarch64 specific: default to clang-14. +RUN apt-get install -y clang-14 +ENV CC=/usr/bin/clang-14 +ENV CXX=/usr/bin/clang++-14 + +# Install Python3 with distutils +RUN apt-get install -y python3 python3-dev python3-pip python3-distutils + +# Install AZ CLI with Python since they do not ship +# aarch64 to APT: https://github.com/Azure/azure-cli/issues/7368 +# Pin so future releases do not break us. +RUN pip3 install azure-cli==2.38.0 + +# Install node16 +RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs + +# Create the pwuser and make it passwordless sudoer. +RUN adduser --disabled-password --gecos "" pwuser && \ + echo "ALL ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers + +# mitigate git clone issues on CI +# See https://stdworkflow.com/877/error-rpc-failed-curl-56-gnutls-recv-error-54-error-in-the-pull-function +RUN git config --system user.email "devops@playwright.dev" && \ + git config --system user.name "Playwright DevOps" && \ + git config --system http.postBuffer 524288000 && \ + git config --system http.lowSpeedLimit 0 && \ + git config --system http.lowSpeedTime 999999 + +# Show welcome message to pwuser +COPY --chown=pwuser ./pwuser_bashrc /home/pwuser/.bashrc + +USER pwuser + +# Install Rust +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +ENV PATH="${PATH}:/home/pwuser/.cargo/bin" + +RUN cd /home/pwuser && git clone --depth=1 https://github.com/microsoft/playwright + +WORKDIR /home/pwuser/playwright + + diff --git a/browser_patches/docker/firefox-beta/ubuntu-22.04.dockerfile b/browser_patches/docker/firefox-beta/ubuntu-22.04.dockerfile new file mode 100644 index 0000000000..f3fd4019b3 --- /dev/null +++ b/browser_patches/docker/firefox-beta/ubuntu-22.04.dockerfile @@ -0,0 +1,53 @@ +FROM --platform=linux/amd64 ubuntu:22.04 + +# Reexport --build-arg as environment variables +ARG ARG_BUILD_FLAVOR +ARG ARG_BROWSER_NAME +ENV BUILD_FLAVOR="${ARG_BUILD_FLAVOR}" +ENV BROWSER_NAME="${ARG_BROWSER_NAME}" + +# These are needed to auto-install tzdata. See https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image +ARG DEBIAN_FRONTEND=noninteractive +ARG TZ=America/Los_Angeles + +RUN apt-get update && apt-get install -y curl \ + build-essential \ + git-core \ + zip unzip \ + tzdata \ + sudo +# Install Python3 with distutils +RUN apt-get install -y python3 python3-dev python3-pip python3-distutils + +# Install Azure CLI +RUN curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash + +# Install node16 +RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs + +# Create the pwuser and make it passwordless sudoer. +RUN adduser --disabled-password --gecos "" pwuser && \ + echo "ALL ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers + +# mitigate git clone issues on CI +# See https://stdworkflow.com/877/error-rpc-failed-curl-56-gnutls-recv-error-54-error-in-the-pull-function +RUN git config --system user.email "devops@playwright.dev" && \ + git config --system user.name "Playwright DevOps" && \ + git config --system http.postBuffer 524288000 && \ + git config --system http.lowSpeedLimit 0 && \ + git config --system http.lowSpeedTime 999999 + +# Show welcome message to pwuser +COPY --chown=pwuser ./pwuser_bashrc /home/pwuser/.bashrc + +USER pwuser + +# Install Rust +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +ENV PATH="${PATH}:/home/pwuser/.cargo/bin" + +RUN cd /home/pwuser && git clone --depth=1 https://github.com/microsoft/playwright + +WORKDIR /home/pwuser/playwright + + diff --git a/browser_patches/docker/firefox/debian-11.dockerfile b/browser_patches/docker/firefox/debian-11.dockerfile new file mode 100644 index 0000000000..034db787a7 --- /dev/null +++ b/browser_patches/docker/firefox/debian-11.dockerfile @@ -0,0 +1,53 @@ +FROM --platform=linux/amd64 debian:11 + +# Reexport --build-arg as environment variables +ARG ARG_BUILD_FLAVOR +ARG ARG_BROWSER_NAME +ENV BUILD_FLAVOR="${ARG_BUILD_FLAVOR}" +ENV BROWSER_NAME="${ARG_BROWSER_NAME}" + +# These are needed to auto-install tzdata. See https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image +ARG DEBIAN_FRONTEND=noninteractive +ARG TZ=America/Los_Angeles + +RUN apt-get update && apt-get install -y curl \ + build-essential \ + git-core \ + zip unzip \ + tzdata \ + sudo +# Install Python3 with distutils +RUN apt-get install -y python3 python3-dev python3-pip python3-distutils + +# Install Azure CLI +RUN curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash + +# Install node16 +RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs + +# Create the pwuser and make it passwordless sudoer. +RUN adduser --disabled-password --gecos "" pwuser && \ + echo "ALL ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers + +# mitigate git clone issues on CI +# See https://stdworkflow.com/877/error-rpc-failed-curl-56-gnutls-recv-error-54-error-in-the-pull-function +RUN git config --system user.email "devops@playwright.dev" && \ + git config --system user.name "Playwright DevOps" && \ + git config --system http.postBuffer 524288000 && \ + git config --system http.lowSpeedLimit 0 && \ + git config --system http.lowSpeedTime 999999 + +# Show welcome message to pwuser +COPY --chown=pwuser ./pwuser_bashrc /home/pwuser/.bashrc + +USER pwuser + +# Install Rust +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +ENV PATH="${PATH}:/home/pwuser/.cargo/bin" + +RUN cd /home/pwuser && git clone --depth=1 https://github.com/microsoft/playwright + +WORKDIR /home/pwuser/playwright + + diff --git a/browser_patches/docker/firefox/ubuntu-18.04.dockerfile b/browser_patches/docker/firefox/ubuntu-18.04.dockerfile new file mode 100644 index 0000000000..2ff837ead5 --- /dev/null +++ b/browser_patches/docker/firefox/ubuntu-18.04.dockerfile @@ -0,0 +1,59 @@ +FROM --platform=linux/amd64 ubuntu:18.04 + +# Reexport --build-arg as environment variables +ARG ARG_BUILD_FLAVOR +ARG ARG_BROWSER_NAME +ENV BUILD_FLAVOR="${ARG_BUILD_FLAVOR}" +ENV BROWSER_NAME="${ARG_BROWSER_NAME}" + +# These are needed to auto-install tzdata. See https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image +ARG DEBIAN_FRONTEND=noninteractive +ARG TZ=America/Los_Angeles + +RUN apt-get update && apt-get install -y curl \ + build-essential \ + git-core \ + zip unzip \ + tzdata \ + sudo +# Install Python3 with distutils +# Firefox build on Ubuntu 18.04 requires Python3.8 to run its build scripts. +RUN apt-get install -y python3.8 python3.8-dev python3.8-distutils && \ + # Point python3 to python3.8 + update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2 && \ + curl -sSL https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \ + python3 get-pip.py && \ + rm get-pip.py + +# Install Azure CLI +RUN curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash + +# Install node16 +RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs + +# Create the pwuser and make it passwordless sudoer. +RUN adduser --disabled-password --gecos "" pwuser && \ + echo "ALL ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers + +# mitigate git clone issues on CI +# See https://stdworkflow.com/877/error-rpc-failed-curl-56-gnutls-recv-error-54-error-in-the-pull-function +RUN git config --system user.email "devops@playwright.dev" && \ + git config --system user.name "Playwright DevOps" && \ + git config --system http.postBuffer 524288000 && \ + git config --system http.lowSpeedLimit 0 && \ + git config --system http.lowSpeedTime 999999 + +# Show welcome message to pwuser +COPY --chown=pwuser ./pwuser_bashrc /home/pwuser/.bashrc + +USER pwuser + +# Install Rust +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +ENV PATH="${PATH}:/home/pwuser/.cargo/bin" + +RUN cd /home/pwuser && git clone --depth=1 https://github.com/microsoft/playwright + +WORKDIR /home/pwuser/playwright + + diff --git a/browser_patches/docker/firefox/ubuntu-20.04-arm64.dockerfile b/browser_patches/docker/firefox/ubuntu-20.04-arm64.dockerfile new file mode 100644 index 0000000000..fd977444fe --- /dev/null +++ b/browser_patches/docker/firefox/ubuntu-20.04-arm64.dockerfile @@ -0,0 +1,61 @@ +FROM --platform=linux/arm64 ubuntu:20.04 + +# Reexport --build-arg as environment variables +ARG ARG_BUILD_FLAVOR +ARG ARG_BROWSER_NAME +ENV BUILD_FLAVOR="${ARG_BUILD_FLAVOR}" +ENV BROWSER_NAME="${ARG_BROWSER_NAME}" + +# These are needed to auto-install tzdata. See https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image +ARG DEBIAN_FRONTEND=noninteractive +ARG TZ=America/Los_Angeles + +RUN apt-get update && apt-get install -y curl \ + build-essential \ + git-core \ + zip unzip \ + tzdata \ + sudo + +# Ubuntu 20.04 aarch64 specific: default to clang-12. +RUN apt-get install -y clang-12 +ENV CC=/usr/bin/clang-12 +ENV CXX=/usr/bin/clang++-12 + +# Install Python3 with distutils +RUN apt-get install -y python3 python3-dev python3-pip python3-distutils + +# Install AZ CLI with Python since they do not ship +# aarch64 to APT: https://github.com/Azure/azure-cli/issues/7368 +# Pin so future releases do not break us. +RUN pip3 install azure-cli==2.38.0 + +# Install node16 +RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs + +# Create the pwuser and make it passwordless sudoer. +RUN adduser --disabled-password --gecos "" pwuser && \ + echo "ALL ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers + +# mitigate git clone issues on CI +# See https://stdworkflow.com/877/error-rpc-failed-curl-56-gnutls-recv-error-54-error-in-the-pull-function +RUN git config --system user.email "devops@playwright.dev" && \ + git config --system user.name "Playwright DevOps" && \ + git config --system http.postBuffer 524288000 && \ + git config --system http.lowSpeedLimit 0 && \ + git config --system http.lowSpeedTime 999999 + +# Show welcome message to pwuser +COPY --chown=pwuser ./pwuser_bashrc /home/pwuser/.bashrc + +USER pwuser + +# Install Rust +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +ENV PATH="${PATH}:/home/pwuser/.cargo/bin" + +RUN cd /home/pwuser && git clone --depth=1 https://github.com/microsoft/playwright + +WORKDIR /home/pwuser/playwright + + diff --git a/browser_patches/docker/firefox/ubuntu-20.04.dockerfile b/browser_patches/docker/firefox/ubuntu-20.04.dockerfile new file mode 100644 index 0000000000..c964549910 --- /dev/null +++ b/browser_patches/docker/firefox/ubuntu-20.04.dockerfile @@ -0,0 +1,53 @@ +FROM --platform=linux/amd64 ubuntu:20.04 + +# Reexport --build-arg as environment variables +ARG ARG_BUILD_FLAVOR +ARG ARG_BROWSER_NAME +ENV BUILD_FLAVOR="${ARG_BUILD_FLAVOR}" +ENV BROWSER_NAME="${ARG_BROWSER_NAME}" + +# These are needed to auto-install tzdata. See https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image +ARG DEBIAN_FRONTEND=noninteractive +ARG TZ=America/Los_Angeles + +RUN apt-get update && apt-get install -y curl \ + build-essential \ + git-core \ + zip unzip \ + tzdata \ + sudo +# Install Python3 with distutils +RUN apt-get install -y python3 python3-dev python3-pip python3-distutils + +# Install Azure CLI +RUN curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash + +# Install node16 +RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs + +# Create the pwuser and make it passwordless sudoer. +RUN adduser --disabled-password --gecos "" pwuser && \ + echo "ALL ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers + +# mitigate git clone issues on CI +# See https://stdworkflow.com/877/error-rpc-failed-curl-56-gnutls-recv-error-54-error-in-the-pull-function +RUN git config --system user.email "devops@playwright.dev" && \ + git config --system user.name "Playwright DevOps" && \ + git config --system http.postBuffer 524288000 && \ + git config --system http.lowSpeedLimit 0 && \ + git config --system http.lowSpeedTime 999999 + +# Show welcome message to pwuser +COPY --chown=pwuser ./pwuser_bashrc /home/pwuser/.bashrc + +USER pwuser + +# Install Rust +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +ENV PATH="${PATH}:/home/pwuser/.cargo/bin" + +RUN cd /home/pwuser && git clone --depth=1 https://github.com/microsoft/playwright + +WORKDIR /home/pwuser/playwright + + diff --git a/browser_patches/docker/firefox/ubuntu-22.04-arm64.dockerfile b/browser_patches/docker/firefox/ubuntu-22.04-arm64.dockerfile new file mode 100644 index 0000000000..71e00ace7c --- /dev/null +++ b/browser_patches/docker/firefox/ubuntu-22.04-arm64.dockerfile @@ -0,0 +1,61 @@ +FROM --platform=linux/arm64 ubuntu:22.04 + +# Reexport --build-arg as environment variables +ARG ARG_BUILD_FLAVOR +ARG ARG_BROWSER_NAME +ENV BUILD_FLAVOR="${ARG_BUILD_FLAVOR}" +ENV BROWSER_NAME="${ARG_BROWSER_NAME}" + +# These are needed to auto-install tzdata. See https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image +ARG DEBIAN_FRONTEND=noninteractive +ARG TZ=America/Los_Angeles + +RUN apt-get update && apt-get install -y curl \ + build-essential \ + git-core \ + zip unzip \ + tzdata \ + sudo + +# Ubuntu 22.04 aarch64 specific: default to clang-14. +RUN apt-get install -y clang-14 +ENV CC=/usr/bin/clang-14 +ENV CXX=/usr/bin/clang++-14 + +# Install Python3 with distutils +RUN apt-get install -y python3 python3-dev python3-pip python3-distutils + +# Install AZ CLI with Python since they do not ship +# aarch64 to APT: https://github.com/Azure/azure-cli/issues/7368 +# Pin so future releases do not break us. +RUN pip3 install azure-cli==2.38.0 + +# Install node16 +RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs + +# Create the pwuser and make it passwordless sudoer. +RUN adduser --disabled-password --gecos "" pwuser && \ + echo "ALL ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers + +# mitigate git clone issues on CI +# See https://stdworkflow.com/877/error-rpc-failed-curl-56-gnutls-recv-error-54-error-in-the-pull-function +RUN git config --system user.email "devops@playwright.dev" && \ + git config --system user.name "Playwright DevOps" && \ + git config --system http.postBuffer 524288000 && \ + git config --system http.lowSpeedLimit 0 && \ + git config --system http.lowSpeedTime 999999 + +# Show welcome message to pwuser +COPY --chown=pwuser ./pwuser_bashrc /home/pwuser/.bashrc + +USER pwuser + +# Install Rust +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +ENV PATH="${PATH}:/home/pwuser/.cargo/bin" + +RUN cd /home/pwuser && git clone --depth=1 https://github.com/microsoft/playwright + +WORKDIR /home/pwuser/playwright + + diff --git a/browser_patches/docker/firefox/ubuntu-22.04.dockerfile b/browser_patches/docker/firefox/ubuntu-22.04.dockerfile new file mode 100644 index 0000000000..f3fd4019b3 --- /dev/null +++ b/browser_patches/docker/firefox/ubuntu-22.04.dockerfile @@ -0,0 +1,53 @@ +FROM --platform=linux/amd64 ubuntu:22.04 + +# Reexport --build-arg as environment variables +ARG ARG_BUILD_FLAVOR +ARG ARG_BROWSER_NAME +ENV BUILD_FLAVOR="${ARG_BUILD_FLAVOR}" +ENV BROWSER_NAME="${ARG_BROWSER_NAME}" + +# These are needed to auto-install tzdata. See https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image +ARG DEBIAN_FRONTEND=noninteractive +ARG TZ=America/Los_Angeles + +RUN apt-get update && apt-get install -y curl \ + build-essential \ + git-core \ + zip unzip \ + tzdata \ + sudo +# Install Python3 with distutils +RUN apt-get install -y python3 python3-dev python3-pip python3-distutils + +# Install Azure CLI +RUN curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash + +# Install node16 +RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs + +# Create the pwuser and make it passwordless sudoer. +RUN adduser --disabled-password --gecos "" pwuser && \ + echo "ALL ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers + +# mitigate git clone issues on CI +# See https://stdworkflow.com/877/error-rpc-failed-curl-56-gnutls-recv-error-54-error-in-the-pull-function +RUN git config --system user.email "devops@playwright.dev" && \ + git config --system user.name "Playwright DevOps" && \ + git config --system http.postBuffer 524288000 && \ + git config --system http.lowSpeedLimit 0 && \ + git config --system http.lowSpeedTime 999999 + +# Show welcome message to pwuser +COPY --chown=pwuser ./pwuser_bashrc /home/pwuser/.bashrc + +USER pwuser + +# Install Rust +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +ENV PATH="${PATH}:/home/pwuser/.cargo/bin" + +RUN cd /home/pwuser && git clone --depth=1 https://github.com/microsoft/playwright + +WORKDIR /home/pwuser/playwright + + diff --git a/browser_patches/docker/pwuser_bashrc b/browser_patches/docker/pwuser_bashrc new file mode 100644 index 0000000000..ed78a6e053 --- /dev/null +++ b/browser_patches/docker/pwuser_bashrc @@ -0,0 +1,29 @@ +source /etc/os-release +if [[ -z "${BUILD_FLAVOR}" ]]; then + BUILD_FLAVOR='' +fi +if [[ -z "${BROWSER_NAME}" ]]; then + BROWSER_NAME='' +fi + +echo "======================================================================" +echo "Welcome to the ${BUILD_FLAVOR} environment!" +echo "- distro: ${PRETTY_NAME}" +echo "- arch: $(arch)" + +if [[ -n "${CXX}" ]]; then + echo "- CXX: ${CXX}" +fi +if [[ -n "${CC}" ]]; then + echo "- CC: ${CC}" +fi + +echo +echo "NOTE: Playwright clone is shallow (has no git history); to unshallow, run:" +echo " git fetch --unshallow" +echo +echo "To get started, prepare your browser checkout:" +echo " CI=1 ./browser_patches/prepare_checkout.sh ${BROWSER_NAME}" +echo +echo "======================================================================" + diff --git a/browser_patches/docker/webkit/debian-11.dockerfile b/browser_patches/docker/webkit/debian-11.dockerfile new file mode 100644 index 0000000000..bb1798e50d --- /dev/null +++ b/browser_patches/docker/webkit/debian-11.dockerfile @@ -0,0 +1,48 @@ +FROM --platform=linux/amd64 debian:11 + +# Reexport --build-arg as environment variables +ARG ARG_BUILD_FLAVOR +ARG ARG_BROWSER_NAME +ENV BUILD_FLAVOR="${ARG_BUILD_FLAVOR}" +ENV BROWSER_NAME="${ARG_BROWSER_NAME}" + +# These are needed to auto-install tzdata. See https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image +ARG DEBIAN_FRONTEND=noninteractive +ARG TZ=America/Los_Angeles + +# Debian 11 specific: add contrib & non-free repositories. +echo "deb http://ftp.us.debian.org/debian bullseye main contrib non-free" >> /etc/apt/sources.list.d/pwbuild.list + +RUN apt-get update && apt-get install -y curl \ + build-essential \ + git-core \ + zip unzip \ + tzdata \ + sudo + +# Install Azure CLI +RUN curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash + +# Install node16 +RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs + +# Create the pwuser and make it passwordless sudoer. +RUN adduser --disabled-password --gecos "" pwuser && \ + echo "ALL ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers + +# mitigate git clone issues on CI +# See https://stdworkflow.com/877/error-rpc-failed-curl-56-gnutls-recv-error-54-error-in-the-pull-function +RUN git config --system user.email "devops@playwright.dev" && \ + git config --system user.name "Playwright DevOps" && \ + git config --system http.postBuffer 524288000 && \ + git config --system http.lowSpeedLimit 0 && \ + git config --system http.lowSpeedTime 999999 + +# Show welcome message +COPY ./pwuser_bashrc /home/pwuser/.bashrc + +USER pwuser +RUN cd /home/pwuser && git clone --depth=1 https://github.com/microsoft/playwright + +WORKDIR /home/pwuser/playwright + diff --git a/browser_patches/docker/webkit/ubuntu-18.04.dockerfile b/browser_patches/docker/webkit/ubuntu-18.04.dockerfile new file mode 100644 index 0000000000..64bec74fe1 --- /dev/null +++ b/browser_patches/docker/webkit/ubuntu-18.04.dockerfile @@ -0,0 +1,57 @@ +FROM --platform=linux/amd64 ubuntu:18.04 + +# Reexport --build-arg as environment variables +ARG ARG_BUILD_FLAVOR +ARG ARG_BROWSER_NAME +ENV BUILD_FLAVOR="${ARG_BUILD_FLAVOR}" +ENV BROWSER_NAME="${ARG_BROWSER_NAME}" + +# These are needed to auto-install tzdata. See https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image +ARG DEBIAN_FRONTEND=noninteractive +ARG TZ=America/Los_Angeles + +RUN apt-get update && apt-get install -y curl \ + build-essential \ + git-core \ + zip unzip \ + tzdata \ + sudo + +# Ubuntu 18.04 specific: update CMake. Default CMake on Ubuntu 18.04 is 3.10, whereas WebKit requires 3.12+. +RUN apt purge --auto-remove cmake && \ + apt-get install -y wget software-properties-common && \ + wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null && \ + apt-add-repository "deb https://apt.kitware.com/ubuntu/ bionic main" && \ + apt-get update && apt-get install -y cmake + +# Ubuntu 18.04 specific: default to gcc-8. Wbkit requires gcc 8.3+. +RUN apt-get install -y gcc-8 g++-8 +ENV CC=/usr/bin/gcc-8 +ENV CXX=/usr/bin/g++-8 + +# Install Azure CLI +RUN curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash + +# Install node16 +RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs + +# Create the pwuser and make it passwordless sudoer. +RUN adduser --disabled-password --gecos "" pwuser && \ + echo "ALL ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers + +# mitigate git clone issues on CI +# See https://stdworkflow.com/877/error-rpc-failed-curl-56-gnutls-recv-error-54-error-in-the-pull-function +RUN git config --system user.email "devops@playwright.dev" && \ + git config --system user.name "Playwright DevOps" && \ + git config --system http.postBuffer 524288000 && \ + git config --system http.lowSpeedLimit 0 && \ + git config --system http.lowSpeedTime 999999 + +# Show welcome message +COPY ./pwuser_bashrc /home/pwuser/.bashrc + +USER pwuser +RUN cd /home/pwuser && git clone --depth=1 https://github.com/microsoft/playwright + +WORKDIR /home/pwuser/playwright + diff --git a/browser_patches/docker/webkit/ubuntu-20.04-arm64.dockerfile b/browser_patches/docker/webkit/ubuntu-20.04-arm64.dockerfile new file mode 100644 index 0000000000..5b30404a56 --- /dev/null +++ b/browser_patches/docker/webkit/ubuntu-20.04-arm64.dockerfile @@ -0,0 +1,56 @@ +FROM --platform=linux/arm64 ubuntu:20.04 + +# Reexport --build-arg as environment variables +ARG ARG_BUILD_FLAVOR +ARG ARG_BROWSER_NAME +ENV BUILD_FLAVOR="${ARG_BUILD_FLAVOR}" +ENV BROWSER_NAME="${ARG_BROWSER_NAME}" + +# These are needed to auto-install tzdata. See https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image +ARG DEBIAN_FRONTEND=noninteractive +ARG TZ=America/Los_Angeles + +RUN apt-get update && apt-get install -y curl \ + build-essential \ + git-core \ + zip unzip \ + tzdata \ + sudo + +# Ubuntu 20.04 aarch64 specific: default to clang-12. +RUN apt-get install -y clang-12 +ENV CC=/usr/bin/clang-12 +ENV CXX=/usr/bin/clang++-12 + +# Install AZ CLI with Python since they do not ship +# aarch64 to APT: https://github.com/Azure/azure-cli/issues/7368 +# Pin so future releases do not break us. +RUN apt-get install -y python3 \ + python3-dev \ + python3-pip \ + python3-distutils && \ + pip3 install azure-cli==2.38.0 + +# Install node16 +RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs + +# Create the pwuser and make it passwordless sudoer. +RUN adduser --disabled-password --gecos "" pwuser && \ + echo "ALL ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers + +# mitigate git clone issues on CI +# See https://stdworkflow.com/877/error-rpc-failed-curl-56-gnutls-recv-error-54-error-in-the-pull-function +RUN git config --system user.email "devops@playwright.dev" && \ + git config --system user.name "Playwright DevOps" && \ + git config --system http.postBuffer 524288000 && \ + git config --system http.lowSpeedLimit 0 && \ + git config --system http.lowSpeedTime 999999 + +# Show welcome message +COPY ./pwuser_bashrc /home/pwuser/.bashrc + +USER pwuser +RUN cd /home/pwuser && git clone --depth=1 https://github.com/microsoft/playwright + +WORKDIR /home/pwuser/playwright + diff --git a/browser_patches/docker/webkit/ubuntu-20.04.dockerfile b/browser_patches/docker/webkit/ubuntu-20.04.dockerfile new file mode 100644 index 0000000000..2609546265 --- /dev/null +++ b/browser_patches/docker/webkit/ubuntu-20.04.dockerfile @@ -0,0 +1,45 @@ +FROM --platform=linux/amd64 ubuntu:20.04 + +# Reexport --build-arg as environment variables +ARG ARG_BUILD_FLAVOR +ARG ARG_BROWSER_NAME +ENV BUILD_FLAVOR="${ARG_BUILD_FLAVOR}" +ENV BROWSER_NAME="${ARG_BROWSER_NAME}" + +# These are needed to auto-install tzdata. See https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image +ARG DEBIAN_FRONTEND=noninteractive +ARG TZ=America/Los_Angeles + +RUN apt-get update && apt-get install -y curl \ + build-essential \ + git-core \ + zip unzip \ + tzdata \ + sudo + +# Install Azure CLI +RUN curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash + +# Install node16 +RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs + +# Create the pwuser and make it passwordless sudoer. +RUN adduser --disabled-password --gecos "" pwuser && \ + echo "ALL ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers + +# mitigate git clone issues on CI +# See https://stdworkflow.com/877/error-rpc-failed-curl-56-gnutls-recv-error-54-error-in-the-pull-function +RUN git config --system user.email "devops@playwright.dev" && \ + git config --system user.name "Playwright DevOps" && \ + git config --system http.postBuffer 524288000 && \ + git config --system http.lowSpeedLimit 0 && \ + git config --system http.lowSpeedTime 999999 + +# Show welcome message +COPY ./pwuser_bashrc /home/pwuser/.bashrc + +USER pwuser +RUN cd /home/pwuser && git clone --depth=1 https://github.com/microsoft/playwright + +WORKDIR /home/pwuser/playwright + diff --git a/browser_patches/docker/webkit/ubuntu-22.04-arm64.dockerfile b/browser_patches/docker/webkit/ubuntu-22.04-arm64.dockerfile new file mode 100644 index 0000000000..30e86a1f3e --- /dev/null +++ b/browser_patches/docker/webkit/ubuntu-22.04-arm64.dockerfile @@ -0,0 +1,56 @@ +FROM --platform=linux/arm64 ubuntu:22.04 + +# Reexport --build-arg as environment variables +ARG ARG_BUILD_FLAVOR +ARG ARG_BROWSER_NAME +ENV BUILD_FLAVOR="${ARG_BUILD_FLAVOR}" +ENV BROWSER_NAME="${ARG_BROWSER_NAME}" + +# These are needed to auto-install tzdata. See https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image +ARG DEBIAN_FRONTEND=noninteractive +ARG TZ=America/Los_Angeles + +RUN apt-get update && apt-get install -y curl \ + build-essential \ + git-core \ + zip unzip \ + tzdata \ + sudo + +# Ubuntu 22.04 aarch64 specific: default to clang-12. +RUN apt-get install -y clang-12 +ENV CC=/usr/bin/clang-12 +ENV CXX=/usr/bin/clang++-12 + +# Install AZ CLI with Python since they do not ship +# aarch64 to APT: https://github.com/Azure/azure-cli/issues/7368 +# Pin so future releases do not break us. +RUN apt-get install -y python3 \ + python3-dev \ + python3-pip \ + python3-distutils && \ + pip3 install azure-cli==2.38.0 + +# Install node16 +RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs + +# Create the pwuser and make it passwordless sudoer. +RUN adduser --disabled-password --gecos "" pwuser && \ + echo "ALL ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers + +# mitigate git clone issues on CI +# See https://stdworkflow.com/877/error-rpc-failed-curl-56-gnutls-recv-error-54-error-in-the-pull-function +RUN git config --system user.email "devops@playwright.dev" && \ + git config --system user.name "Playwright DevOps" && \ + git config --system http.postBuffer 524288000 && \ + git config --system http.lowSpeedLimit 0 && \ + git config --system http.lowSpeedTime 999999 + +# Show welcome message +COPY ./pwuser_bashrc /home/pwuser/.bashrc + +USER pwuser +RUN cd /home/pwuser && git clone --depth=1 https://github.com/microsoft/playwright + +WORKDIR /home/pwuser/playwright + diff --git a/browser_patches/docker/webkit/ubuntu-22.04.dockerfile b/browser_patches/docker/webkit/ubuntu-22.04.dockerfile new file mode 100644 index 0000000000..928874b654 --- /dev/null +++ b/browser_patches/docker/webkit/ubuntu-22.04.dockerfile @@ -0,0 +1,45 @@ +FROM --platform=linux/amd64 ubuntu:22.04 + +# Reexport --build-arg as environment variables +ARG ARG_BUILD_FLAVOR +ARG ARG_BROWSER_NAME +ENV BUILD_FLAVOR="${ARG_BUILD_FLAVOR}" +ENV BROWSER_NAME="${ARG_BROWSER_NAME}" + +# These are needed to auto-install tzdata. See https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image +ARG DEBIAN_FRONTEND=noninteractive +ARG TZ=America/Los_Angeles + +RUN apt-get update && apt-get install -y curl \ + build-essential \ + git-core \ + zip unzip \ + tzdata \ + sudo + +# Install Azure CLI +RUN curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash + +# Install node16 +RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs + +# Create the pwuser and make it passwordless sudoer. +RUN adduser --disabled-password --gecos "" pwuser && \ + echo "ALL ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers + +# mitigate git clone issues on CI +# See https://stdworkflow.com/877/error-rpc-failed-curl-56-gnutls-recv-error-54-error-in-the-pull-function +RUN git config --system user.email "devops@playwright.dev" && \ + git config --system user.name "Playwright DevOps" && \ + git config --system http.postBuffer 524288000 && \ + git config --system http.lowSpeedLimit 0 && \ + git config --system http.lowSpeedTime 999999 + +# Show welcome message +COPY ./pwuser_bashrc /home/pwuser/.bashrc + +USER pwuser +RUN cd /home/pwuser && git clone --depth=1 https://github.com/microsoft/playwright + +WORKDIR /home/pwuser/playwright + diff --git a/browser_patches/docker_build.sh b/browser_patches/docker_build.sh deleted file mode 100755 index 1c354e5e7b..0000000000 --- a/browser_patches/docker_build.sh +++ /dev/null @@ -1,230 +0,0 @@ -#!/bin/bash -# This script is designed to build Firefox & WebKit on various Linux -# distributions inside docker containers. -set -e -set -x -set -o pipefail - -if [[ ($1 == '--help') || ($1 == '-h') ]]; then - echo "usage: $(basename "$0") [webkit-ubuntu-20.04|firefox-debian-11|...] [prepare|compile|enter|kill]" - echo - echo "Builds Webkit or Firefox browser inside given Linux distribution" - echo "NOTE: Run without second argument to enter bash inside the prepared docker container." - exit 0 -fi - -export BUILD_FLAVOR="${1}" - -DOCKER_PLATFORM="linux/amd64" -DOCKER_IMAGE_NAME="" - -############################################################ -### FIREFOX ### -############################################################ - -if [[ "${BUILD_FLAVOR}" == "firefox-ubuntu-18.04" ]]; then - DOCKER_PLATFORM="linux/amd64" - DOCKER_IMAGE_NAME="ubuntu:18.04" -elif [[ "${BUILD_FLAVOR}" == "firefox-ubuntu-20.04" ]]; then - DOCKER_PLATFORM="linux/amd64" - DOCKER_IMAGE_NAME="ubuntu:20.04" -elif [[ "${BUILD_FLAVOR}" == "firefox-ubuntu-20.04-arm64" ]]; then - DOCKER_PLATFORM="linux/arm64" - DOCKER_IMAGE_NAME="ubuntu:20.04" -elif [[ "${BUILD_FLAVOR}" == "firefox-ubuntu-22.04" ]]; then - DOCKER_PLATFORM="linux/amd64" - DOCKER_IMAGE_NAME="ubuntu:22.04" -elif [[ "${BUILD_FLAVOR}" == "firefox-ubuntu-22.04-arm64" ]]; then - DOCKER_PLATFORM="linux/arm64" - DOCKER_IMAGE_NAME="ubuntu:22.04" -elif [[ "${BUILD_FLAVOR}" == "firefox-debian-11" ]]; then - DOCKER_PLATFORM="linux/amd64" - DOCKER_IMAGE_NAME="debian:11" - -############################################################ -### FIREFOX-BETA ### -############################################################ - -elif [[ "${BUILD_FLAVOR}" == "firefox-beta-ubuntu-18.04" ]]; then - DOCKER_PLATFORM="linux/amd64" - DOCKER_IMAGE_NAME="ubuntu:18.04" -elif [[ "${BUILD_FLAVOR}" == "firefox-beta-ubuntu-20.04" ]]; then - DOCKER_PLATFORM="linux/amd64" - DOCKER_IMAGE_NAME="ubuntu:20.04" -elif [[ "${BUILD_FLAVOR}" == "firefox-beta-ubuntu-20.04-arm64" ]]; then - DOCKER_PLATFORM="linux/arm64" - DOCKER_IMAGE_NAME="ubuntu:20.04" -elif [[ "${BUILD_FLAVOR}" == "firefox-beta-ubuntu-22.04" ]]; then - DOCKER_PLATFORM="linux/amd64" - DOCKER_IMAGE_NAME="ubuntu:22.04" -elif [[ "${BUILD_FLAVOR}" == "firefox-beta-ubuntu-22.04-arm64" ]]; then - DOCKER_PLATFORM="linux/arm64" - DOCKER_IMAGE_NAME="ubuntu:22.04" -elif [[ "${BUILD_FLAVOR}" == "firefox-beta-debian-11" ]]; then - DOCKER_PLATFORM="linux/amd64" - DOCKER_IMAGE_NAME="debian:11" - -############################################################ -### WEBKIT ### -############################################################ - -elif [[ "${BUILD_FLAVOR}" == "webkit-ubuntu-18.04" ]]; then - DOCKER_PLATFORM="linux/amd64" - DOCKER_IMAGE_NAME="ubuntu:18.04" -elif [[ "${BUILD_FLAVOR}" == "webkit-ubuntu-20.04" ]]; then - DOCKER_PLATFORM="linux/amd64" - DOCKER_IMAGE_NAME="ubuntu:20.04" -elif [[ "${BUILD_FLAVOR}" == "webkit-ubuntu-20.04-arm64" ]]; then - DOCKER_PLATFORM="linux/arm64" - DOCKER_IMAGE_NAME="ubuntu:20.04" -elif [[ "${BUILD_FLAVOR}" == "webkit-ubuntu-22.04" ]]; then - DOCKER_PLATFORM="linux/amd64" - DOCKER_IMAGE_NAME="ubuntu:22.04" -elif [[ "${BUILD_FLAVOR}" == "webkit-ubuntu-22.04-arm64" ]]; then - DOCKER_PLATFORM="linux/arm64" - DOCKER_IMAGE_NAME="ubuntu:22.04" -elif [[ "${BUILD_FLAVOR}" == "webkit-debian-11" ]]; then - DOCKER_PLATFORM="linux/amd64" - DOCKER_IMAGE_NAME="debian:11" -else - echo "ERROR: unknown build flavor - '${BUILD_FLAVOR}'" - exit 1 -fi - -DOCKER_CONTAINER_NAME="build-${BUILD_FLAVOR}" -DOCKER_ARGS=$(echo \ - --env CI \ - --env BUILD_FLAVOR \ - --env TELEGRAM_BOT_KEY \ - --env AZ_ACCOUNT_NAME \ - --env AZ_ACCOUNT_KEY \ - --env GITHUB_SERVER_URL \ - --env GITHUB_REPOSITORY \ - --env GITHUB_RUN_ID \ - --env GH_TOKEN \ - --env DEBIAN_FRONTEND=noninteractive \ - --env TZ="America/Los_Angeles" -) - -function ensure_docker_container { - if docker ps | grep "${DOCKER_CONTAINER_NAME}" 2>&1 1>/dev/null; then - return; - fi - docker pull --platform "${DOCKER_PLATFORM}" "${DOCKER_IMAGE_NAME}" - docker run --rm ${DOCKER_ARGS} --name "${DOCKER_CONTAINER_NAME}" --platform "${DOCKER_PLATFORM}" -d -t "${DOCKER_IMAGE_NAME}" /bin/bash - docker exec ${DOCKER_ARGS} "${DOCKER_CONTAINER_NAME}" /bin/bash -c ' - set -e - arch - if [[ "${BUILD_FLAVOR}" == webkit-debian-11 ]]; then - # Add contrib & non-free to package list - echo "deb http://ftp.us.debian.org/debian bullseye main contrib non-free" >> /etc/apt/sources.list.d/pwbuild.list - fi - - apt-get update && apt-get install -y wget \ - git-core \ - curl \ - autoconf2.13 \ - tzdata \ - sudo \ - zip \ - gcc \ - unzip - - if [[ "${BUILD_FLAVOR}" == "firefox-ubuntu-22.04-arm64" || "${BUILD_FLAVOR}" == "firefox-beta-ubuntu-22.04-arm64" ]]; then - apt-get install -y clang-14 - elif [[ "${BUILD_FLAVOR}" == *"-arm64" ]]; then - apt-get install -y clang-12 - fi - - # Install Python3. - # Firefox build on Ubuntu 18.04 requires Python3.8 to run its build scripts. - # WebKit build on Ubuntu 18.04 fails with the Python 3.8 installation but works - # with Python 3.6 that is shipped as default python3 on Ubuntu 18. - if [[ "${BUILD_FLAVOR}" == "firefox-ubuntu-18.04" || "${BUILD_FLAVOR}" == "firefox-beta-ubuntu-18.04" ]]; then - apt-get install -y python3.8 python3.8-dev python3.8-distutils - # Point python3 to python3.8 - update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2 - curl -sSL https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \ - python3 get-pip.py && \ - rm get-pip.py - else - apt-get install -y python3 python3-dev python3-pip python3-distutils - fi - - # Install AZ CLI with Python since they do not ship - # aarch64 to APT: https://github.com/Azure/azure-cli/issues/7368 - # Pin so future releases dont break us. - pip3 install azure-cli==2.38.0 - - # Create the pwuser and make it passwordless sudoer. - adduser --disabled-password --gecos "" pwuser - echo "ALL ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers - - # Install node16 - curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs - - if [[ "${BUILD_FLAVOR}" == "firefox-"* ]]; then - # install rust as a pwuser - su -l pwuser -c "curl --proto \"=https\" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y" - echo "PATH=\"${PATH}:/home/pwuser/.cargo/bin\"" > /etc/environment - elif [[ "${BUILD_FLAVOR}" == "webkit-ubuntu-18.04" ]]; then - # Ubuntu 18.04 specific: update CMake. Default CMake on Ubuntu 18.04 is 3.10, whereas WebKit requires 3.12+. - apt purge --auto-remove cmake - apt-get install -y wget software-properties-common - wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null - apt-add-repository "deb https://apt.kitware.com/ubuntu/ bionic main" - apt-get update && apt-get install -y cmake - - # Ubuntu 18.04 specific: install GCC-8. WebKit requires gcc 8.3+ to compile. - apt-get install -y gcc-8 g++-8 - fi - - git config --system user.email "you@example.com" - git config --system user.name "Your Name" - - # mitigate git clone issues on CI. - # See https://stdworkflow.com/877/error-rpc-failed-curl-56-gnutls-recv-error-54-error-in-the-pull-function - git config --system http.postBuffer 524288000 - git config --system http.lowSpeedLimit 0 - git config --system http.lowSpeedTime 999999 - - cd /home/pwuser - su -l pwuser -c "git clone --depth=1 https://github.com/microsoft/playwright" - ' -} - -if [[ "$2" == "prepare" || "$2" == "start" ]]; then - ensure_docker_container -elif [[ "$2" == "compile" ]]; then - ensure_docker_container - echo "BUILD FLAVOR: ${BUILD_FLAVOR}" - docker exec --user pwuser --workdir "/home/pwuser/playwright" ${DOCKER_ARGS} "${DOCKER_CONTAINER_NAME}" /bin/bash -c ' - if [[ "${BUILD_FLAVOR}" == "webkit-ubuntu-18.04" ]]; then - export CC=/usr/bin/gcc-8 - export CXX=/usr/bin/g++-8 - elif [[ "${BUILD_FLAVOR}" == "firefox-ubuntu-22.04-arm64" || "${BUILD_FLAVOR}" == "firefox-beta-ubuntu-22.04-arm64" ]]; then - export CC=/usr/bin/clang-14 - export CXX=/usr/bin/clang++-14 - elif [[ "${BUILD_FLAVOR}" == *"-arm64" ]]; then - export CC=/usr/bin/clang-12 - export CXX=/usr/bin/clang++-12 - fi - # For non-login non-interactive shells, we have to source - # cargo env explicitly since /env/environment is not read. - if [[ -f "$HOME/.cargo/env" ]]; then - source "$HOME/.cargo/env" - fi - ./browser_patches/checkout_build_archive_upload.sh "${BUILD_FLAVOR}" - ' -elif [[ "$2" == "enter" || -z "$2" ]]; then - ensure_docker_container - docker exec --user pwuser --workdir "/home/pwuser/playwright" ${DOCKER_ARGS} -it "${DOCKER_CONTAINER_NAME}" /bin/bash -elif [[ "$2" == "kill" || "$2" == "stop" ]]; then - docker kill "${DOCKER_CONTAINER_NAME}" - # Wait for container to stop - docker wait "${DOCKER_CONTAINER_NAME}" || true -else - echo "ERROR: unknown command - $2" - exit 1 -fi -