Skip to content

Commit ab6bea1

Browse files
authored
chore: publish official jammy image (#1477)
1 parent eecef85 commit ab6bea1

File tree

5 files changed

+97
-6
lines changed

5 files changed

+97
-6
lines changed

.github/workflows/test_docker.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ on:
1919
jobs:
2020
build:
2121
timeout-minutes: 60
22-
runs-on: ubuntu-20.04
22+
runs-on: ubuntu-22.04
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
docker-image-variant:
27+
- focal
28+
- jammy
2329
steps:
2430
- uses: actions/checkout@v2
2531
- name: Set up Python
@@ -32,10 +38,10 @@ jobs:
3238
pip install -r local-requirements.txt
3339
pip install -e .
3440
- name: Build Docker image
35-
run: bash utils/docker/build.sh --amd64 focal playwright-python:localbuild-focal
41+
run: bash utils/docker/build.sh --amd64 ${{ matrix.docker-image-variant }} playwright-python:localbuild-${{ matrix.docker-image-variant }}
3642
- name: Test
3743
run: |
38-
CONTAINER_ID="$(docker run --rm -v $(pwd):/root/playwright --name playwright-docker-test --workdir /root/playwright/ -d -t playwright-python:localbuild-focal /bin/bash)"
44+
CONTAINER_ID="$(docker run --rm -v $(pwd):/root/playwright --name playwright-docker-test --workdir /root/playwright/ -d -t playwright-python:localbuild-${{ matrix.docker-image-variant }} /bin/bash)"
3945
# Fix permissions for Git inside the container
4046
docker exec "${CONTAINER_ID}" chown -R root:root /root/playwright
4147
docker exec "${CONTAINER_ID}" pip install -r local-requirements.txt
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: "Internal Tests"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- release-*
8+
9+
jobs:
10+
trigger:
11+
name: "trigger"
12+
runs-on: ubuntu-20.04
13+
steps:
14+
- run: |
15+
curl -X POST \
16+
-H "Accept: application/vnd.github.v3+json" \
17+
-H "Authorization: token ${GH_TOKEN}" \
18+
--data "{\"event_type\": \"playwright_tests_python\", \"client_payload\": {\"ref\": \"${GITHUB_SHA}\"}}" \
19+
https://api.github.com/repos/microsoft/playwright-internal/dispatches
20+
env:
21+
GH_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}

utils/docker/Dockerfile.jammy

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
FROM ubuntu:jammy
2+
3+
ARG DEBIAN_FRONTEND=noninteractive
4+
ARG TZ=America/Los_Angeles
5+
ARG DOCKER_IMAGE_NAME_TEMPLATE="mcr.microsoft.com/playwright/python:v%version%-jammy"
6+
7+
# === INSTALL Python ===
8+
9+
RUN apt-get update && \
10+
# Install Python
11+
apt-get install -y python3 python3-distutils curl && \
12+
update-alternatives --install /usr/bin/python python /usr/bin/python3 1 && \
13+
curl -sSL https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
14+
python get-pip.py && \
15+
rm get-pip.py && \
16+
# Feature-parity with node.js base images.
17+
apt-get install -y --no-install-recommends git openssh-client gpg && \
18+
# clean apt cache
19+
rm -rf /var/lib/apt/lists/* && \
20+
# Create the pwuser
21+
adduser pwuser
22+
23+
# === BAKE BROWSERS INTO IMAGE ===
24+
25+
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
26+
27+
# 1. Add tip-of-tree Playwright package to install its browsers.
28+
# The package should be built beforehand from tip-of-tree Playwright.
29+
COPY ./dist/*-manylinux*.whl /tmp/
30+
31+
# 2. Bake in browsers & deps.
32+
# Browsers will be downloaded in `/ms-playwright`.
33+
# Note: make sure to set 777 to the registry so that any user can access
34+
# registry.
35+
RUN mkdir /ms-playwright && \
36+
mkdir /ms-playwright-agent && \
37+
cd /ms-playwright-agent && \
38+
# if its amd64 then install the manylinux1_x86_64 pip package
39+
if [ "$(uname -m)" = "x86_64" ]; then pip install /tmp/*manylinux1_x86_64*.whl; fi && \
40+
# if its arm64 then install the manylinux1_aarch64 pip package
41+
if [ "$(uname -m)" = "aarch64" ]; then pip install /tmp/*manylinux_2_17_aarch64*.whl; fi && \
42+
playwright mark-docker-image "${DOCKER_IMAGE_NAME_TEMPLATE}" && \
43+
playwright install --with-deps && rm -rf /var/lib/apt/lists/* && \
44+
rm /tmp/*.whl && \
45+
rm -rf /ms-playwright-agent && \
46+
chmod -R 777 /ms-playwright

utils/docker/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -e
33
set +x
44

55
if [[ ($1 == '--help') || ($1 == '-h') || ($1 == '') || ($2 == '') ]]; then
6-
echo "usage: $(basename $0) {--arm64,--amd64} {bionic,focal} playwright:localbuild-focal"
6+
echo "usage: $(basename $0) {--arm64,--amd64} {bionic,focal,jammy} playwright:localbuild-focal"
77
echo
88
echo "Build Playwright docker image and tag it as 'playwright:localbuild-focal'."
99
echo "Once image is built, you can run it with"

utils/docker/publish_docker.sh

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ FOCAL_TAGS=(
4444
"next-focal"
4545
)
4646

47+
JAMMY_TAGS=(
48+
"next-jammy"
49+
)
50+
if [[ "$RELEASE_CHANNEL" == "stable" ]]; then
51+
JAMMY_TAGS+=("jammy")
52+
fi
53+
4754
if [[ "$RELEASE_CHANNEL" == "stable" ]]; then
4855
FOCAL_TAGS+=("latest")
4956
FOCAL_TAGS+=("focal")
@@ -66,8 +73,10 @@ publish_docker_images_with_arch_suffix() {
6673
TAGS=("${BIONIC_TAGS[@]}")
6774
elif [[ "$FLAVOR" == "focal" ]]; then
6875
TAGS=("${FOCAL_TAGS[@]}")
76+
elif [[ "$FLAVOR" == "jammy" ]]; then
77+
TAGS=("${JAMMY_TAGS[@]}")
6978
else
70-
echo "ERROR: unknown flavor - $FLAVOR. Must be either 'bionic' or 'focal'"
79+
echo "ERROR: unknown flavor - $FLAVOR. Must be either 'bionic', 'focal', or 'jammy'"
7180
exit 1
7281
fi
7382
local ARCH="$2"
@@ -92,8 +101,10 @@ publish_docker_manifest () {
92101
TAGS=("${BIONIC_TAGS[@]}")
93102
elif [[ "$FLAVOR" == "focal" ]]; then
94103
TAGS=("${FOCAL_TAGS[@]}")
104+
elif [[ "$FLAVOR" == "jammy" ]]; then
105+
TAGS=("${JAMMY_TAGS[@]}")
95106
else
96-
echo "ERROR: unknown flavor - $FLAVOR. Must be either 'bionic' or 'focal'"
107+
echo "ERROR: unknown flavor - $FLAVOR. Must be either 'bionic', 'focal', or 'jammy'"
97108
exit 1
98109
fi
99110

@@ -112,9 +123,16 @@ publish_docker_manifest () {
112123
done
113124
}
114125

126+
# Bionic
115127
publish_docker_images_with_arch_suffix bionic amd64
116128
publish_docker_manifest bionic amd64
117129

130+
# Focal
118131
publish_docker_images_with_arch_suffix focal amd64
119132
publish_docker_images_with_arch_suffix focal arm64
120133
publish_docker_manifest focal amd64 arm64
134+
135+
# Jammy
136+
publish_docker_images_with_arch_suffix jammy amd64
137+
publish_docker_images_with_arch_suffix jammy arm64
138+
publish_docker_manifest jammy amd64 arm64

0 commit comments

Comments
 (0)