chore: prepare to publish dockerfile.vrt docker image (#19324)
This patch: - adds a new `Dockerfile.vrt` image file based on focal that installs VRT-related dependencies inside it. - updates scripts to build & publish the new docker image. Drive-by: remove stale file
This commit is contained in:
Родитель
dd58609a0b
Коммит
59a41f6051
|
@ -0,0 +1,50 @@
|
|||
FROM ubuntu:focal
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
ARG TZ=America/Los_Angeles
|
||||
ARG DOCKER_IMAGE_NAME_TEMPLATE="mcr.microsoft.com/playwright:v%version%-vrt"
|
||||
|
||||
# === INSTALL Node.js ===
|
||||
|
||||
RUN apt-get update && \
|
||||
# Install node16
|
||||
apt-get install -y curl wget gpg && \
|
||||
curl -sL https://deb.nodesource.com/setup_16.x | bash - && \
|
||||
apt-get install -y nodejs && \
|
||||
# Feature-parity with node.js base images.
|
||||
apt-get install -y --no-install-recommends git openssh-client && \
|
||||
npm install -g yarn && \
|
||||
# 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 ./playwright-core.tar.gz /tmp/playwright-core.tar.gz
|
||||
|
||||
# 2. Bake in Playwright Agent.
|
||||
# Playwright Agent is used to bake in browsers and browser dependencies,
|
||||
# and run docker server later on.
|
||||
# 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 && npm init -y && \
|
||||
npm i /tmp/playwright-core.tar.gz && \
|
||||
npx playwright mark-docker-image "${DOCKER_IMAGE_NAME_TEMPLATE}" && \
|
||||
npx playwright install --with-deps && \
|
||||
npx playwright docker install-server-deps && \
|
||||
rm /tmp/playwright-core.tar.gz && \
|
||||
chmod -R 777 /ms-playwright && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /ms-playwright-agent
|
||||
ENV DISPLAY_NUM=99
|
||||
ENV DISPLAY=:99
|
||||
ENTRYPOINT npx playwright docker run-server
|
|
@ -3,7 +3,7 @@ set -e
|
|||
set +x
|
||||
|
||||
if [[ ($1 == '--help') || ($1 == '-h') || ($1 == '') || ($2 == '') ]]; then
|
||||
echo "usage: $(basename $0) {--arm64,--amd64} {focal,jammy} playwright:localbuild-focal"
|
||||
echo "usage: $(basename $0) {--arm64,--amd64} {focal,jammy,vrt} playwright:localbuild-focal"
|
||||
echo
|
||||
echo "Build Playwright docker image and tag it as 'playwright:localbuild-focal'."
|
||||
echo "Once image is built, you can run it with"
|
||||
|
|
|
@ -53,6 +53,15 @@ if [[ "$RELEASE_CHANNEL" == "stable" ]]; then
|
|||
JAMMY_TAGS+=("jammy")
|
||||
fi
|
||||
|
||||
VRT_TAGS=(
|
||||
"next-vrt"
|
||||
"v${PW_VERSION}-vrt"
|
||||
)
|
||||
|
||||
if [[ "$RELEASE_CHANNEL" == "stable" ]]; then
|
||||
VRT_TAGS+=("vrt")
|
||||
fi
|
||||
|
||||
tag_and_push() {
|
||||
local source="$1"
|
||||
local target="$2"
|
||||
|
@ -68,8 +77,10 @@ publish_docker_images_with_arch_suffix() {
|
|||
TAGS=("${FOCAL_TAGS[@]}")
|
||||
elif [[ "$FLAVOR" == "jammy" ]]; then
|
||||
TAGS=("${JAMMY_TAGS[@]}")
|
||||
elif [[ "$FLAVOR" == "vrt" ]]; then
|
||||
TAGS=("${VRT_TAGS[@]}")
|
||||
else
|
||||
echo "ERROR: unknown flavor - $FLAVOR. Must be either 'focal', or 'jammy'"
|
||||
echo "ERROR: unknown flavor - $FLAVOR. Must be either 'focal', 'jammy' or 'vrt'"
|
||||
exit 1
|
||||
fi
|
||||
local ARCH="$2"
|
||||
|
@ -94,8 +105,10 @@ publish_docker_manifest () {
|
|||
TAGS=("${FOCAL_TAGS[@]}")
|
||||
elif [[ "$FLAVOR" == "jammy" ]]; then
|
||||
TAGS=("${JAMMY_TAGS[@]}")
|
||||
elif [[ "$FLAVOR" == "vrt" ]]; then
|
||||
TAGS=("${VRT_TAGS[@]}")
|
||||
else
|
||||
echo "ERROR: unknown flavor - $FLAVOR. Must be either 'focal', or 'jammy'"
|
||||
echo "ERROR: unknown flavor - $FLAVOR. Must be either 'focal', 'jammy' or 'vrt'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -121,3 +134,7 @@ publish_docker_manifest focal amd64 arm64
|
|||
publish_docker_images_with_arch_suffix jammy amd64
|
||||
publish_docker_images_with_arch_suffix jammy arm64
|
||||
publish_docker_manifest jammy amd64 arm64
|
||||
|
||||
publish_docker_images_with_arch_suffix vrt amd64
|
||||
publish_docker_images_with_arch_suffix vrt arm64
|
||||
publish_docker_manifest vrt amd64 arm64
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
set +x
|
||||
|
||||
DISPLAY_NUM=99
|
||||
export DISPLAY=":${DISPLAY_NUM}"
|
||||
|
||||
SCREEN_WIDTH=1360
|
||||
SCREEN_HEIGHT=1020
|
||||
SCREEN_DEPTH=24
|
||||
SCREEN_DPI=96
|
||||
GEOMETRY="${SCREEN_WIDTH}""x""${SCREEN_HEIGHT}""x""${SCREEN_DEPTH}"
|
||||
|
||||
nohup /usr/bin/xvfb-run --server-num=${DISPLAY_NUM} \
|
||||
--listen-tcp \
|
||||
--server-args="-screen 0 ${GEOMETRY} -fbdir /var/tmp -dpi ${SCREEN_DPI} -listen tcp -noreset -ac +extension RANDR" \
|
||||
/usr/bin/fluxbox -display ${DISPLAY} >/dev/null 2>&1 &
|
||||
|
||||
for i in $(seq 1 50)
|
||||
do
|
||||
if xdpyinfo -display ${DISPLAY} >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
echo "Waiting for Xvfb..."
|
||||
sleep 0.2
|
||||
done
|
||||
|
||||
nohup x11vnc -forever -shared -rfbport 5900 -rfbportv6 5900 -display ${DISPLAY} >/dev/null 2>&1 &
|
||||
nohup /opt/bin/noVNC/utils/launch.sh --listen 7900 --vnc localhost:5900 >/dev/null 2>&1 &
|
||||
|
||||
npx playwright experimental-grid-agent --agent-id "$1" --grid-url "$2"
|
Загрузка…
Ссылка в новой задаче