Skip to content

Commit 7d35be4

Browse files
authored
devops: publish Ubuntu 24.04 Docker image (microsoft#1649)
1 parent 800c2e9 commit 7d35be4

4 files changed

Lines changed: 73 additions & 27 deletions

File tree

.github/workflows/publish_docker.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ on:
33
release:
44
types: [published]
55
workflow_dispatch:
6-
inputs:
7-
is_release:
8-
required: true
9-
type: boolean
10-
description: "Is this a release image?"
116
jobs:
127
publish-canary-docker:
138
name: publish to DockerHub
@@ -33,6 +28,3 @@ jobs:
3328
platforms: arm64
3429
- uses: actions/checkout@v4
3530
- run: ./utils/docker/publish_docker.sh stable
36-
if: (github.event_name != 'workflow_dispatch' && !github.event.release.prerelease) || (github.event_name == 'workflow_dispatch' && github.event.inputs.is_release == 'true')
37-
- run: ./utils/docker/publish_docker.sh canary
38-
if: (github.event_name != 'workflow_dispatch' && github.event.release.prerelease) || (github.event_name == 'workflow_dispatch' && github.event.inputs.is_release != 'true')

.github/workflows/test_docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
strategy:
2525
fail-fast: false
2626
matrix:
27-
flavor: [focal, jammy]
27+
flavor: [focal, jammy, noble]
2828
steps:
2929
- uses: actions/checkout@v3
3030
- name: Build Docker image

utils/docker/Dockerfile.noble

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

utils/docker/publish_docker.sh

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,34 +21,27 @@ if [[ "${RELEASE_CHANNEL}" == "stable" ]]; then
2121
echo "ERROR: cannot publish stable docker with Playwright version '${PW_VERSION}'"
2222
exit 1
2323
fi
24-
elif [[ "${RELEASE_CHANNEL}" == "canary" ]]; then
25-
:
2624
else
2725
echo "ERROR: unknown release channel - ${RELEASE_CHANNEL}"
2826
echo "Must be either 'stable' or 'canary'"
2927
exit 1
3028
fi
3129

30+
# Ubuntu 20.04
3231
FOCAL_TAGS=(
33-
"next-focal"
32+
"v${PW_VERSION}-focal"
3433
)
3534

36-
if [[ "$RELEASE_CHANNEL" == "stable" ]]; then
37-
FOCAL_TAGS+=("focal")
38-
FOCAL_TAGS+=("v${PW_VERSION}-focal")
39-
fi
40-
35+
# Ubuntu 22.04
4136
JAMMY_TAGS=(
42-
"next"
43-
"next-jammy"
37+
"v${PW_VERSION}-jammy"
4438
)
4539

46-
if [[ "$RELEASE_CHANNEL" == "stable" ]]; then
47-
JAMMY_TAGS+=("jammy")
48-
JAMMY_TAGS+=("latest")
49-
JAMMY_TAGS+=("v${PW_VERSION}")
50-
JAMMY_TAGS+=("v${PW_VERSION}-jammy")
51-
fi
40+
# Ubuntu 24.04
41+
NOBLE_TAGS=(
42+
"v${PW_VERSION}"
43+
"v${PW_VERSION}-noble"
44+
)
5245

5346
tag_and_push() {
5447
local source="$1"
@@ -86,8 +79,10 @@ publish_docker_images_with_arch_suffix() {
8679
TAGS=("${FOCAL_TAGS[@]}")
8780
elif [[ "$FLAVOR" == "jammy" ]]; then
8881
TAGS=("${JAMMY_TAGS[@]}")
82+
elif [[ "$FLAVOR" == "noble" ]]; then
83+
TAGS=("${NOBLE_TAGS[@]}")
8984
else
90-
echo "ERROR: unknown flavor - $FLAVOR. Must be either 'focal' or 'jammy'"
85+
echo "ERROR: unknown flavor - $FLAVOR. Must be either 'focal', 'jammy', or 'noble'"
9186
exit 1
9287
fi
9388
local ARCH="$2"
@@ -112,8 +107,10 @@ publish_docker_manifest () {
112107
TAGS=("${FOCAL_TAGS[@]}")
113108
elif [[ "$FLAVOR" == "jammy" ]]; then
114109
TAGS=("${JAMMY_TAGS[@]}")
110+
elif [[ "$FLAVOR" == "noble" ]]; then
111+
TAGS=("${NOBLE_TAGS[@]}")
115112
else
116-
echo "ERROR: unknown flavor - $FLAVOR. Must be either 'focal' or 'jammy'"
113+
echo "ERROR: unknown flavor - $FLAVOR. Must be either 'focal', 'jammy', 'noble'"
117114
exit 1
118115
fi
119116

@@ -139,3 +136,7 @@ publish_docker_manifest focal amd64 arm64
139136
publish_docker_images_with_arch_suffix jammy amd64
140137
publish_docker_images_with_arch_suffix jammy arm64
141138
publish_docker_manifest jammy amd64 arm64
139+
140+
publish_docker_images_with_arch_suffix noble amd64
141+
publish_docker_images_with_arch_suffix noble arm64
142+
publish_docker_manifest noble amd64 arm64

0 commit comments

Comments
 (0)