Skip to content

Commit e70dcec

Browse files
authored
devops: add Ubuntu 24.04 (noble) Docker images (microsoft#2521)
1 parent 799c124 commit e70dcec

File tree

4 files changed

+72
-28
lines changed

4 files changed

+72
-28
lines changed

.github/workflows/publish_docker.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@ name: "publish release - Docker"
22

33
on:
44
workflow_dispatch:
5-
inputs:
6-
is_release:
7-
required: false
8-
type: boolean
9-
description: "Is this a release image?"
10-
115
release:
126
types: [published]
137

@@ -44,6 +38,3 @@ jobs:
4438
pip install -r local-requirements.txt
4539
pip install -e .
4640
- run: ./utils/docker/publish_docker.sh stable
47-
if: (github.event_name != 'workflow_dispatch' && !github.event.release.prerelease) || (github.event_name == 'workflow_dispatch' && github.event.inputs.is_release == 'true')
48-
- run: ./utils/docker/publish_docker.sh canary
49-
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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ on:
1919
jobs:
2020
build:
2121
timeout-minutes: 120
22-
runs-on: ubuntu-22.04
22+
runs-on: ubuntu-24.04
2323
strategy:
2424
fail-fast: false
2525
matrix:
2626
docker-image-variant:
2727
- focal
2828
- jammy
29+
- noble
2930
steps:
3031
- uses: actions/checkout@v3
3132
- name: Set up Python

utils/docker/Dockerfile.noble

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

utils/docker/publish_docker.sh

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,27 @@ if [[ "${RELEASE_CHANNEL}" == "stable" ]]; then
1515
echo "ERROR: cannot publish stable docker with Playwright version '${PW_VERSION}'"
1616
exit 1
1717
fi
18-
elif [[ "${RELEASE_CHANNEL}" == "canary" ]]; then
19-
if [[ "${PW_VERSION}" != *dev* ]]; then
20-
echo "ERROR: cannot publish canary docker with Playwright version '${PW_VERSION}'"
21-
exit 1
22-
fi
2318
else
2419
echo "ERROR: unknown release channel - ${RELEASE_CHANNEL}"
2520
echo "Must be either 'stable' or 'canary'"
2621
exit 1
2722
fi
2823

24+
# Ubuntu 20.04
2925
FOCAL_TAGS=(
30-
"next-focal"
26+
"v${PW_VERSION}-focal"
3127
)
32-
if [[ "$RELEASE_CHANNEL" == "stable" ]]; then
33-
FOCAL_TAGS+=("focal")
34-
FOCAL_TAGS+=("v${PW_VERSION}-focal")
35-
fi
3628

29+
# Ubuntu 22.04
3730
JAMMY_TAGS=(
38-
"next"
39-
"next-jammy"
31+
"v${PW_VERSION}-jammy"
32+
)
33+
34+
# Ubuntu 24.04
35+
NOBLE_TAGS=(
36+
"v${PW_VERSION}"
37+
"v${PW_VERSION}-noble"
4038
)
41-
if [[ "$RELEASE_CHANNEL" == "stable" ]]; then
42-
JAMMY_TAGS+=("latest")
43-
JAMMY_TAGS+=("jammy")
44-
JAMMY_TAGS+=("v${PW_VERSION}-jammy")
45-
JAMMY_TAGS+=("v${PW_VERSION}")
46-
fi
4739

4840
tag_and_push() {
4941
local source="$1"
@@ -81,6 +73,8 @@ publish_docker_images_with_arch_suffix() {
8173
TAGS=("${FOCAL_TAGS[@]}")
8274
elif [[ "$FLAVOR" == "jammy" ]]; then
8375
TAGS=("${JAMMY_TAGS[@]}")
76+
elif [[ "$FLAVOR" == "noble" ]]; then
77+
TAGS=("${NOBLE_TAGS[@]}")
8478
else
8579
echo "ERROR: unknown flavor - $FLAVOR. Must be either 'focal', or 'jammy'"
8680
exit 1
@@ -107,6 +101,8 @@ publish_docker_manifest () {
107101
TAGS=("${FOCAL_TAGS[@]}")
108102
elif [[ "$FLAVOR" == "jammy" ]]; then
109103
TAGS=("${JAMMY_TAGS[@]}")
104+
elif [[ "$FLAVOR" == "noble" ]]; then
105+
TAGS=("${NOBLE_TAGS[@]}")
110106
else
111107
echo "ERROR: unknown flavor - $FLAVOR. Must be either 'focal', or 'jammy'"
112108
exit 1
@@ -136,3 +132,7 @@ publish_docker_manifest focal amd64 arm64
136132
publish_docker_images_with_arch_suffix jammy amd64
137133
publish_docker_images_with_arch_suffix jammy arm64
138134
publish_docker_manifest jammy amd64 arm64
135+
136+
publish_docker_images_with_arch_suffix noble amd64
137+
publish_docker_images_with_arch_suffix noble arm64
138+
publish_docker_manifest noble amd64 arm64

0 commit comments

Comments
 (0)