Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

devops: add Ubuntu 24.04 (noble) Docker images #2521

Merged
merged 3 commits into from
Aug 13, 2024
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
9 changes: 0 additions & 9 deletions .github/workflows/publish_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ name: "publish release - Docker"

on:
workflow_dispatch:
inputs:
is_release:
required: false
type: boolean
description: "Is this a release image?"

release:
types: [published]

Expand Down Expand Up @@ -44,6 +38,3 @@ jobs:
pip install -r local-requirements.txt
pip install -e .
- run: ./utils/docker/publish_docker.sh stable
if: (github.event_name != 'workflow_dispatch' && !github.event.release.prerelease) || (github.event_name == 'workflow_dispatch' && github.event.inputs.is_release == 'true')
- run: ./utils/docker/publish_docker.sh canary
if: (github.event_name != 'workflow_dispatch' && github.event.release.prerelease) || (github.event_name == 'workflow_dispatch' && github.event.inputs.is_release != 'true')
3 changes: 2 additions & 1 deletion .github/workflows/test_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ on:
jobs:
build:
timeout-minutes: 120
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
docker-image-variant:
- focal
- jammy
- noble
steps:
- uses: actions/checkout@v3
- name: Set up Python
Expand Down
52 changes: 52 additions & 0 deletions utils/docker/Dockerfile.noble
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
FROM ubuntu:noble

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

# === INSTALL Python ===

RUN apt-get update && \
# Install Python
apt-get install -y python3 curl && \
# Align with upstream Python image and don't be externally managed:
# https://github.com/docker-library/python/issues/948
rm /usr/lib/python3.12/EXTERNALLY-MANAGED && \
update-alternatives --install /usr/bin/python python /usr/bin/python3 1 && \
curl -sSL https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
python get-pip.py && \
rm get-pip.py && \
# Feature-parity with node.js base images.
apt-get install -y --no-install-recommends git openssh-client 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/*-manylinux*.whl /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 && \
pip install virtualenv && \
virtualenv venv && \
. venv/bin/activate && \
# if its amd64 then install the manylinux1_x86_64 pip package
if [ "$(uname -m)" = "x86_64" ]; then pip install /tmp/*manylinux1_x86_64*.whl; fi && \
# if its arm64 then install the manylinux1_aarch64 pip package
if [ "$(uname -m)" = "aarch64" ]; then pip install /tmp/*manylinux_2_17_aarch64*.whl; fi && \
playwright mark-docker-image "${DOCKER_IMAGE_NAME_TEMPLATE}" && \
playwright install --with-deps && rm -rf /var/lib/apt/lists/* && \
rm /tmp/*.whl && \
rm -rf /ms-playwright-agent && \
chmod -R 777 /ms-playwright
36 changes: 18 additions & 18 deletions utils/docker/publish_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,27 @@ if [[ "${RELEASE_CHANNEL}" == "stable" ]]; then
echo "ERROR: cannot publish stable docker with Playwright version '${PW_VERSION}'"
exit 1
fi
elif [[ "${RELEASE_CHANNEL}" == "canary" ]]; then
if [[ "${PW_VERSION}" != *dev* ]]; then
echo "ERROR: cannot publish canary docker with Playwright version '${PW_VERSION}'"
exit 1
fi
else
echo "ERROR: unknown release channel - ${RELEASE_CHANNEL}"
echo "Must be either 'stable' or 'canary'"
exit 1
fi

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

# Ubuntu 22.04
JAMMY_TAGS=(
"next"
"next-jammy"
"v${PW_VERSION}-jammy"
)

# Ubuntu 24.04
NOBLE_TAGS=(
"v${PW_VERSION}"
"v${PW_VERSION}-noble"
)
if [[ "$RELEASE_CHANNEL" == "stable" ]]; then
JAMMY_TAGS+=("latest")
JAMMY_TAGS+=("jammy")
JAMMY_TAGS+=("v${PW_VERSION}-jammy")
JAMMY_TAGS+=("v${PW_VERSION}")
fi

tag_and_push() {
local source="$1"
Expand Down Expand Up @@ -81,6 +73,8 @@ publish_docker_images_with_arch_suffix() {
TAGS=("${FOCAL_TAGS[@]}")
elif [[ "$FLAVOR" == "jammy" ]]; then
TAGS=("${JAMMY_TAGS[@]}")
elif [[ "$FLAVOR" == "noble" ]]; then
TAGS=("${NOBLE_TAGS[@]}")
else
echo "ERROR: unknown flavor - $FLAVOR. Must be either 'focal', or 'jammy'"
exit 1
Expand All @@ -107,6 +101,8 @@ publish_docker_manifest () {
TAGS=("${FOCAL_TAGS[@]}")
elif [[ "$FLAVOR" == "jammy" ]]; then
TAGS=("${JAMMY_TAGS[@]}")
elif [[ "$FLAVOR" == "noble" ]]; then
TAGS=("${NOBLE_TAGS[@]}")
else
echo "ERROR: unknown flavor - $FLAVOR. Must be either 'focal', or 'jammy'"
exit 1
Expand Down Expand Up @@ -136,3 +132,7 @@ publish_docker_manifest focal amd64 arm64
publish_docker_images_with_arch_suffix jammy amd64
publish_docker_images_with_arch_suffix jammy arm64
publish_docker_manifest jammy amd64 arm64

publish_docker_images_with_arch_suffix noble amd64
publish_docker_images_with_arch_suffix noble arm64
publish_docker_manifest noble amd64 arm64
Loading