Skip to content

Commit 804c577

Browse files
authored
devops: publish Jammy Docker images (#1262)
1 parent c237fae commit 804c577

File tree

4 files changed

+90
-23
lines changed

4 files changed

+90
-23
lines changed

.github/workflows/test_docker.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test Docker
1+
name: Docker
22
on:
33
push:
44
paths:
@@ -18,13 +18,18 @@ on:
1818
- release-*
1919
jobs:
2020
test:
21-
timeout-minutes: 60
22-
runs-on: ubuntu-20.04
21+
name: Test
22+
timeout-minutes: 120
23+
runs-on: ubuntu-22.04
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
flavor: [focal, jammy]
2328
steps:
24-
- uses: actions/checkout@v2
29+
- uses: actions/checkout@v3
2530
- name: Build Docker image
26-
run: bash utils/docker/build.sh --amd64 focal playwright-java:localbuild-focal
31+
run: bash utils/docker/build.sh --amd64 ${{ matrix.flavor }} playwright-java:localbuild-${{ matrix.flavor }}
2732
- name: Test
2833
run: |
29-
CONTAINER_ID="$(docker run --rm --ipc=host -v $(pwd):/root/playwright --name playwright-docker-test -d -t playwright-java:localbuild-focal /bin/bash)"
34+
CONTAINER_ID="$(docker run --rm --ipc=host -v $(pwd):/root/playwright --name playwright-docker-test -d -t playwright-java:localbuild-${{ matrix.flavor }} /bin/bash)"
3035
docker exec "${CONTAINER_ID}" /root/playwright/tools/test-local-installation/create_project_and_run_tests.sh

utils/docker/Dockerfile.jammy

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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/java:v%version%-jammy"
6+
7+
# === INSTALL JDK and Maven ===
8+
9+
RUN apt-get update && \
10+
# Install install jdk 17 in a separate apt-get command so that
11+
# installing maven doesn't bring in jdk 11
12+
apt-get install -y --no-install-recommends openjdk-17-jdk && \
13+
apt-get install -y --no-install-recommends \
14+
# Ubuntu 22.04 and earlier come with Maven 3.6.3 which fails with
15+
# Java 17, so we install latest Maven from Apache instead.
16+
# maven \
17+
# Install utilities required for downloading browsers
18+
curl \
19+
# Install utilities required for downloading driver
20+
unzip \
21+
# For the MSEdge install script
22+
gpg && \
23+
rm -rf /var/lib/apt/lists/* && \
24+
# Create the pwuser
25+
adduser pwuser
26+
27+
RUN VERSION=3.8.8 && \
28+
curl -o - https://archive.apache.org/dist/maven/maven-3/$VERSION/binaries/apache-maven-$VERSION-bin.tar.gz | tar zxfv - -C /opt/ && \
29+
ln -s /opt/apache-maven-$VERSION/bin/mvn /usr/local/bin/
30+
31+
ARG PW_TARGET_ARCH
32+
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-${PW_TARGET_ARCH}
33+
34+
# === BAKE BROWSERS INTO IMAGE ===
35+
36+
# Browsers will remain downloaded in `/ms-playwright`.
37+
# Note: make sure to set 777 to the registry so that any user can access
38+
# registry.
39+
40+
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
41+
42+
RUN mkdir /ms-playwright && \
43+
mkdir /tmp/pw-java
44+
45+
COPY . /tmp/pw-java
46+
47+
RUN cd /tmp/pw-java && \
48+
./scripts/download_driver_for_all_platforms.sh && \
49+
mvn install -D skipTests --no-transfer-progress && \
50+
DEBIAN_FRONTEND=noninteractive mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI \
51+
-D exec.args="install-deps" -f playwright/pom.xml --no-transfer-progress && \
52+
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI \
53+
-D exec.args="install" -f playwright/pom.xml --no-transfer-progress && \
54+
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI \
55+
-D exec.args="mark-docker-image '${DOCKER_IMAGE_NAME_TEMPLATE}'" -f playwright/pom.xml --no-transfer-progress && \
56+
rm -rf /tmp/pw-java && \
57+
chmod -R 777 $PLAYWRIGHT_BROWSERS_PATH

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} {focal} playwright:localbuild-focal"
6+
echo "usage: $(basename $0) {--arm64,--amd64} {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: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,6 @@ if [[ -z "${GITHUB_SHA}" ]]; then
3434
exit 1
3535
fi
3636

37-
BIONIC_TAGS=(
38-
"next-bionic"
39-
"v${PW_VERSION}-bionic"
40-
)
41-
if [[ "$RELEASE_CHANNEL" == "stable" ]]; then
42-
BIONIC_TAGS+=("bionic")
43-
fi
44-
4537
FOCAL_TAGS=(
4638
"next"
4739
"sha-${GITHUB_SHA}"
@@ -55,6 +47,15 @@ if [[ "$RELEASE_CHANNEL" == "stable" ]]; then
5547
FOCAL_TAGS+=("v${PW_VERSION}")
5648
fi
5749

50+
JAMMY_TAGS=(
51+
"next-jammy"
52+
"v${PW_VERSION}-jammy"
53+
)
54+
55+
if [[ "$RELEASE_CHANNEL" == "stable" ]]; then
56+
JAMMY_TAGS+=("jammy")
57+
fi
58+
5859
tag_and_push() {
5960
local source="$1"
6061
local target="$2"
@@ -66,12 +67,12 @@ tag_and_push() {
6667
publish_docker_images_with_arch_suffix() {
6768
local FLAVOR="$1"
6869
local TAGS=()
69-
if [[ "$FLAVOR" == "bionic" ]]; then
70-
TAGS=("${BIONIC_TAGS[@]}")
71-
elif [[ "$FLAVOR" == "focal" ]]; then
70+
if [[ "$FLAVOR" == "focal" ]]; then
7271
TAGS=("${FOCAL_TAGS[@]}")
72+
elif [[ "$FLAVOR" == "jammy" ]]; then
73+
TAGS=("${JAMMY_TAGS[@]}")
7374
else
74-
echo "ERROR: unknown flavor - $FLAVOR. Must be either 'bionic' or 'focal'"
75+
echo "ERROR: unknown flavor - $FLAVOR. Must be either 'focal' or 'jammy'"
7576
exit 1
7677
fi
7778
local ARCH="$2"
@@ -92,12 +93,12 @@ publish_docker_images_with_arch_suffix() {
9293
publish_docker_manifest () {
9394
local FLAVOR="$1"
9495
local TAGS=()
95-
if [[ "$FLAVOR" == "bionic" ]]; then
96-
TAGS=("${BIONIC_TAGS[@]}")
97-
elif [[ "$FLAVOR" == "focal" ]]; then
96+
if [[ "$FLAVOR" == "focal" ]]; then
9897
TAGS=("${FOCAL_TAGS[@]}")
98+
elif [[ "$FLAVOR" == "jammy" ]]; then
99+
TAGS=("${JAMMY_TAGS[@]}")
99100
else
100-
echo "ERROR: unknown flavor - $FLAVOR. Must be either 'bionic' or 'focal'"
101+
echo "ERROR: unknown flavor - $FLAVOR. Must be either 'focal' or 'jammy'"
101102
exit 1
102103
fi
103104

@@ -119,3 +120,7 @@ publish_docker_manifest () {
119120
publish_docker_images_with_arch_suffix focal amd64
120121
publish_docker_images_with_arch_suffix focal arm64
121122
publish_docker_manifest focal amd64 arm64
123+
124+
publish_docker_images_with_arch_suffix jammy amd64
125+
publish_docker_images_with_arch_suffix jammy arm64
126+
publish_docker_manifest jammy amd64 arm64

0 commit comments

Comments
 (0)