chore: add Ubuntu 24.04 (noble) Docker image (#2983)

This commit is contained in:
Max Schmitt 2024-08-12 17:06:36 +02:00 коммит произвёл GitHub
Родитель 78a4474a07
Коммит 2c69b54f4e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
4 изменённых файлов: 57 добавлений и 29 удалений

9
.github/workflows/publish_docker.yml поставляемый
Просмотреть файл

@ -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]
@ -42,6 +36,3 @@ jobs:
with:
platforms: arm64
- 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')

14
.github/workflows/test_docker.yml поставляемый
Просмотреть файл

@ -20,6 +20,10 @@ jobs:
build:
timeout-minutes: 60
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
flavor: [jammy, noble]
steps:
- uses: actions/checkout@v3
- name: Setup .NET Core
@ -30,12 +34,12 @@ jobs:
shell: bash
run: ./build.sh --download-driver
- name: Build Docker image
run: bash utils/docker/build.sh --amd64 jammy playwright-dotnet:localbuild-jammy
run: bash utils/docker/build.sh --amd64 ${{ matrix.flavor }} playwright-dotnet:localbuild-${{ matrix.flavor }}
- name: Cleanup
run: dotnet clean src/ || true
- name: Test
run: |
CONTAINER_ID="$(docker run --rm --ipc=host -v $(pwd):/root/playwright --name playwright-docker-test --workdir /root/playwright/ -d -t playwright-dotnet:localbuild-jammy /bin/bash)"
docker exec -e BROWSER=chromium "${CONTAINER_ID}" xvfb-run dotnet test ./src/Playwright.Tests/Playwright.Tests.csproj -c Debug -f net8.0 --logger:"console;verbosity=detailed"
docker exec -e BROWSER=firefox "${CONTAINER_ID}" xvfb-run dotnet test ./src/Playwright.Tests/Playwright.Tests.csproj -c Debug -f net8.0 --logger:"console;verbosity=detailed"
docker exec -e BROWSER=webkit "${CONTAINER_ID}" xvfb-run dotnet test ./src/Playwright.Tests/Playwright.Tests.csproj -c Debug -f net8.0 --logger:"console;verbosity=detailed"
CONTAINER_ID="$(docker run --rm --ipc=host -v $(pwd):/root/playwright --name playwright-docker-test --workdir /root/playwright/ -d -t playwright-dotnet:localbuild-${{ matrix.flavor }} /bin/bash)"
docker exec -e BROWSER=chromium "${CONTAINER_ID}" xvfb-run dotnet test ./src/Playwright.Tests/Playwright.Tests.csproj -c Debug --logger:"console;verbosity=detailed"
docker exec -e BROWSER=firefox "${CONTAINER_ID}" xvfb-run dotnet test ./src/Playwright.Tests/Playwright.Tests.csproj -c Debug --logger:"console;verbosity=detailed"
docker exec -e BROWSER=webkit "${CONTAINER_ID}" xvfb-run dotnet test ./src/Playwright.Tests/Playwright.Tests.csproj -c Debug --logger:"console;verbosity=detailed"

Просмотреть файл

@ -0,0 +1,34 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0-noble
ARG DEBIAN_FRONTEND=noninteractive
ARG TZ=America/Los_Angeles
ARG DOCKER_IMAGE_NAME_TEMPLATE="mcr.microsoft.com/playwright/dotnet:v%version%-noble"
# === INSTALL dependencies ===
RUN apt-get update && \
# Feature-parity with node.js base images.
apt-get install -y --no-install-recommends git openssh-client curl 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/ /tmp/playwright-dotnet
# 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 && \
/tmp/playwright-dotnet/playwright.ps1 install --with-deps && \
/tmp/playwright-dotnet/playwright.ps1 mark-docker-image "${DOCKER_IMAGE_NAME_TEMPLATE}" && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /tmp/* && \
chmod -R 777 /ms-playwright

Просмотреть файл

@ -15,32 +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
:
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"
@ -131,3 +126,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