Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions utils/docker/Dockerfile.jammy
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0-jammy

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

# === INSTALL dependencies ===

RUN 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
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/* /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 && \
dotnet new console && \
echo '<?xml version="1.0" encoding="utf-8"?><configuration><packageSources><add key="local" value="/tmp/"/></packageSources></configuration>' > nuget.config && \
dotnet add package Microsoft.Playwright --prerelease && \
dotnet build && \
./bin/Debug/net6.0/playwright.ps1 install --with-deps && \
./bin/Debug/net6.0/playwright.ps1 mark-docker-image "${DOCKER_IMAGE_NAME_TEMPLATE}" && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /tmp/* && \
rm -rf /ms-playwright-agent && \
chmod -R 777 /ms-playwright
2 changes: 1 addition & 1 deletion utils/docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -e
set +x

if [[ ($1 == '--help') || ($1 == '-h') || ($1 == '') || ($2 == '') ]]; then
echo "usage: $(basename $0) {--arm64,--amd64} {bionic,focal} playwright:localbuild-focal"
echo "usage: $(basename $0) {--arm64,--amd64} {focal,jammy} 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"
Expand Down
33 changes: 16 additions & 17 deletions utils/docker/publish_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,26 @@ if [[ -z "${GITHUB_SHA}" ]]; then
exit 1
fi

BIONIC_TAGS=(
"next-bionic"
"v${PW_VERSION}-bionic"
)
if [[ "$RELEASE_CHANNEL" == "stable" ]]; then
BIONIC_TAGS+=("bionic")
fi

FOCAL_TAGS=(
"next"
"sha-${GITHUB_SHA}"
"next-focal"
)

if [[ "$RELEASE_CHANNEL" == "stable" ]]; then
FOCAL_TAGS+=("latest")
FOCAL_TAGS+=("focal")
FOCAL_TAGS+=("v${PW_VERSION}-focal")
FOCAL_TAGS+=("v${PW_VERSION}")
fi

JAMMY_TAGS=(
"next-jammy"
)
if [[ "$RELEASE_CHANNEL" == "stable" ]]; then
JAMMY_TAGS+=("jammy")
JAMMY_TAGS+=("v${PW_VERSION}-jammy")
fi

tag_and_push() {
local source="$1"
local target="$2"
Expand All @@ -60,12 +59,12 @@ tag_and_push() {
publish_docker_images_with_arch_suffix() {
local FLAVOR="$1"
local TAGS=()
if [[ "$FLAVOR" == "bionic" ]]; then
TAGS=("${BIONIC_TAGS[@]}")
elif [[ "$FLAVOR" == "focal" ]]; then
if [[ "$FLAVOR" == "focal" ]]; then
TAGS=("${FOCAL_TAGS[@]}")
elif [[ "$FLAVOR" == "jammy" ]]; then
TAGS=("$JAMMY_TAGS[@]}")
else
echo "ERROR: unknown flavor - $FLAVOR. Must be either 'bionic' or 'focal'"
echo "ERROR: unknown flavor - $FLAVOR. Must be either 'focal' or 'jammy'"
exit 1
fi
local ARCH="$2"
Expand All @@ -86,12 +85,12 @@ publish_docker_images_with_arch_suffix() {
publish_docker_manifest () {
local FLAVOR="$1"
local TAGS=()
if [[ "$FLAVOR" == "bionic" ]]; then
TAGS=("${BIONIC_TAGS[@]}")
elif [[ "$FLAVOR" == "focal" ]]; then
if [[ "$FLAVOR" == "focal" ]]; then
TAGS=("${FOCAL_TAGS[@]}")
elif [[ "$FLAVOR" == "jammy" ]]; then
TAGS=("${JAMMY_TAGS[@]}")
else
echo "ERROR: unknown flavor - $FLAVOR. Must be either 'bionic' or 'focal'"
echo "ERROR: unknown flavor - $FLAVOR. Must be either 'focal' or 'jammy'"
exit 1
fi

Expand Down