devops: Docker publishing cleanups (#12341)

This commit is contained in:
Max Schmitt 2022-02-24 18:10:34 +01:00 committed by GitHub
parent 0b55950d6a
commit 428a014cad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 17 deletions

View File

@ -10,7 +10,7 @@ on:
jobs: jobs:
publish-canary: publish-canary:
name: "publish canary NPM & Trigger canary Docker" name: "publish canary NPM & Publish canary Docker"
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
if: github.repository == 'microsoft/playwright' if: github.repository == 'microsoft/playwright'
steps: steps:

View File

@ -4,6 +4,7 @@ on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
is_release: is_release:
required: true
type: boolean type: boolean
description: "Is this a release image?" description: "Is this a release image?"

View File

@ -10,20 +10,16 @@ RUN apt-get update && \
apt-get install -y curl wget && \ apt-get install -y curl wget && \
curl -sL https://deb.nodesource.com/setup_16.x | bash - && \ curl -sL https://deb.nodesource.com/setup_16.x | bash - && \
apt-get install -y nodejs && \ apt-get install -y nodejs && \
# Feature-parity with node.js base images. # Feature-parity with node.js base images.
apt-get install -y --no-install-recommends git openssh-client && \ apt-get install -y --no-install-recommends git openssh-client && \
npm install -g yarn && \ npm install -g yarn && \
# Install Python 3.8 # Install Python 3.8
apt-get install -y python3.8 python3-pip && \ apt-get install -y python3.8 python3-pip && \
update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 && \ update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 && \
update-alternatives --install /usr/bin/python python /usr/bin/python3 1 && \ update-alternatives --install /usr/bin/python python /usr/bin/python3 1 && \
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1 && \ update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1 && \
# clean apt cache # clean apt cache
rm -rf /var/lib/apt/lists/* && \ rm -rf /var/lib/apt/lists/* && \
# Create the pwuser (we internally create a symlink for the pwuser and the root user) # Create the pwuser (we internally create a symlink for the pwuser and the root user)
adduser pwuser adduser pwuser

View File

@ -6,25 +6,20 @@ ARG TZ=America/Los_Angeles
# === INSTALL Node.js === # === INSTALL Node.js ===
RUN apt-get update && \ RUN apt-get update && \
# Install node16 # Install node16
apt-get install -y curl wget && \ apt-get install -y curl wget && \
curl -sL https://deb.nodesource.com/setup_16.x | bash - && \ curl -sL https://deb.nodesource.com/setup_16.x | bash - && \
apt-get install -y nodejs && \ apt-get install -y nodejs && \
# Feature-parity with node.js base images. # Feature-parity with node.js base images.
apt-get install -y --no-install-recommends git openssh-client && \ apt-get install -y --no-install-recommends git openssh-client && \
npm install -g yarn && \ npm install -g yarn && \
# Install Python 3.8 # Install Python 3.8
apt-get install -y python3.8 python3-pip && \ apt-get install -y python3.8 python3-pip && \
update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 && \ update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 && \
update-alternatives --install /usr/bin/python python /usr/bin/python3 1 && \ update-alternatives --install /usr/bin/python python /usr/bin/python3 1 && \
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1 && \ update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1 && \
# clean apt cache # clean apt cache
rm -rf /var/lib/apt/lists/* && \ rm -rf /var/lib/apt/lists/* && \
# Create the pwuser # Create the pwuser
adduser pwuser adduser pwuser

View File

@ -6,7 +6,9 @@ set +x
trap "cd $(pwd -P)" EXIT trap "cd $(pwd -P)" EXIT
cd "$(dirname "$0")" cd "$(dirname "$0")"
MCR_IMAGE_NAME="playwright"
PW_VERSION=$(node -e 'console.log(require("../../package.json").version)') PW_VERSION=$(node -e 'console.log(require("../../package.json").version)')
RELEASE_CHANNEL="$1" RELEASE_CHANNEL="$1"
if [[ "${RELEASE_CHANNEL}" == "stable" ]]; then if [[ "${RELEASE_CHANNEL}" == "stable" ]]; then
if [[ "${PW_VERSION}" == *-* ]]; then if [[ "${PW_VERSION}" == *-* ]]; then
@ -50,6 +52,14 @@ if [[ "$RELEASE_CHANNEL" == "stable" ]]; then
FOCAL_TAGS+=("focal") FOCAL_TAGS+=("focal")
fi fi
tag_and_push() {
local source="$1"
local target="$2"
echo "-- tagging: $target"
docker tag $source $target
docker push $target
}
publish_docker_images_with_arch_suffix() { publish_docker_images_with_arch_suffix() {
local FLAVOR="$1" local FLAVOR="$1"
local TAGS=() local TAGS=()
@ -72,7 +82,7 @@ publish_docker_images_with_arch_suffix() {
for ((i = 0; i < ${#TAGS[@]}; i++)) do for ((i = 0; i < ${#TAGS[@]}; i++)) do
local TAG="${TAGS[$i]}" local TAG="${TAGS[$i]}"
./tag_and_push.sh playwright:localbuild "playwright.azurecr.io/public/playwright:${TAG}-${ARCH}" tag_and_push playwright:localbuild "playwright.azurecr.io/public/${MCR_IMAGE_NAME}:${TAG}-${ARCH}"
done done
} }
@ -90,7 +100,7 @@ publish_docker_manifest () {
for ((i = 0; i < ${#TAGS[@]}; i++)) do for ((i = 0; i < ${#TAGS[@]}; i++)) do
local TAG="${TAGS[$i]}" local TAG="${TAGS[$i]}"
local BASE_IMAGE_TAG="playwright.azurecr.io/public/playwright:${TAG}" local BASE_IMAGE_TAG="playwright.azurecr.io/public/${MCR_IMAGE_NAME}:${TAG}"
local IMAGE_NAMES="" local IMAGE_NAMES=""
if [[ "$2" == "arm64" || "$2" == "amd64" ]]; then if [[ "$2" == "arm64" || "$2" == "amd64" ]]; then
IMAGE_NAMES="${IMAGE_NAMES} ${BASE_IMAGE_TAG}-$2" IMAGE_NAMES="${IMAGE_NAMES} ${BASE_IMAGE_TAG}-$2"

View File

@ -1,5 +0,0 @@
#!/bin/bash
echo "-- tagging: $2"
docker tag $1 $2
docker push $2