devops: publish Ubuntu 24.04 Docker image (#1649)
This commit is contained in:
@@ -3,11 +3,6 @@ on:
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
is_release:
|
||||
required: true
|
||||
type: boolean
|
||||
description: "Is this a release image?"
|
||||
jobs:
|
||||
publish-canary-docker:
|
||||
name: publish to DockerHub
|
||||
@@ -33,6 +28,3 @@ jobs:
|
||||
platforms: arm64
|
||||
- uses: actions/checkout@v4
|
||||
- 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')
|
||||
|
||||
@@ -24,7 +24,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
flavor: [focal, jammy]
|
||||
flavor: [focal, jammy, noble]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Build Docker image
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
FROM ubuntu:noble
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
ARG TZ=America/Los_Angeles
|
||||
ARG DOCKER_IMAGE_NAME_TEMPLATE="mcr.microsoft.com/playwright/java:v%version%-noble"
|
||||
|
||||
# === INSTALL JDK and Maven ===
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends openjdk-21-jdk \
|
||||
# Install utilities required for downloading browsers
|
||||
curl \
|
||||
# Install utilities required for downloading driver
|
||||
unzip \
|
||||
# For the MSEdge install script
|
||||
gpg && \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
# Create the pwuser
|
||||
adduser pwuser
|
||||
|
||||
# Ubuntu 22.04 and earlier come with Maven 3.6.3 which fails with
|
||||
# Java 21, so we install latest Maven from Apache instead.
|
||||
RUN VERSION=3.9.6 && \
|
||||
curl -o - https://archive.apache.org/dist/maven/maven-3/$VERSION/binaries/apache-maven-$VERSION-bin.tar.gz | tar zxfv - -C /opt/ && \
|
||||
ln -s /opt/apache-maven-$VERSION/bin/mvn /usr/local/bin/
|
||||
|
||||
ARG PW_TARGET_ARCH
|
||||
ENV JAVA_HOME=/usr/lib/jvm/java-21-openjdk-${PW_TARGET_ARCH}
|
||||
|
||||
# === BAKE BROWSERS INTO IMAGE ===
|
||||
|
||||
# Browsers will remain downloaded in `/ms-playwright`.
|
||||
# Note: make sure to set 777 to the registry so that any user can access
|
||||
# registry.
|
||||
|
||||
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
|
||||
|
||||
RUN mkdir /ms-playwright && \
|
||||
mkdir /tmp/pw-java
|
||||
|
||||
COPY . /tmp/pw-java
|
||||
|
||||
RUN cd /tmp/pw-java && \
|
||||
./scripts/download_driver.sh && \
|
||||
mvn install -D skipTests --no-transfer-progress && \
|
||||
DEBIAN_FRONTEND=noninteractive mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI \
|
||||
-D exec.args="install-deps" -f playwright/pom.xml --no-transfer-progress && \
|
||||
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI \
|
||||
-D exec.args="install" -f playwright/pom.xml --no-transfer-progress && \
|
||||
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI \
|
||||
-D exec.args="mark-docker-image '${DOCKER_IMAGE_NAME_TEMPLATE}'" -f playwright/pom.xml --no-transfer-progress && \
|
||||
rm -rf /tmp/pw-java && \
|
||||
chmod -R 777 $PLAYWRIGHT_BROWSERS_PATH
|
||||
@@ -21,34 +21,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"
|
||||
)
|
||||
|
||||
if [[ "$RELEASE_CHANNEL" == "stable" ]]; then
|
||||
JAMMY_TAGS+=("jammy")
|
||||
JAMMY_TAGS+=("latest")
|
||||
JAMMY_TAGS+=("v${PW_VERSION}")
|
||||
JAMMY_TAGS+=("v${PW_VERSION}-jammy")
|
||||
fi
|
||||
# Ubuntu 24.04
|
||||
NOBLE_TAGS=(
|
||||
"v${PW_VERSION}"
|
||||
"v${PW_VERSION}-noble"
|
||||
)
|
||||
|
||||
tag_and_push() {
|
||||
local source="$1"
|
||||
@@ -86,8 +79,10 @@ 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'"
|
||||
echo "ERROR: unknown flavor - $FLAVOR. Must be either 'focal', 'jammy', or 'noble'"
|
||||
exit 1
|
||||
fi
|
||||
local ARCH="$2"
|
||||
@@ -112,8 +107,10 @@ 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'"
|
||||
echo "ERROR: unknown flavor - $FLAVOR. Must be either 'focal', 'jammy', 'noble'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -139,3 +136,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
|
||||
|
||||
Reference in New Issue
Block a user