Unverified Commit fc8edc47 authored by Benjamin Woodruff's avatar Benjamin Woodruff Committed by GitHub

[ci] Remove dead playwright docker image creation logic (#94576)

We reverted the use of this docker image in
https://github.com/vercel/next.js/pull/94366

We're going to use GitHub actions custom runner images instead (which
don't use docker)
parent a1c695a8
# syntax=docker.io/docker/dockerfile:1
# Loosely based on:
# https://github.com/microsoft/playwright/blob/main/utils/docker/Dockerfile.noble
FROM ubuntu:noble
ARG NODE_VERSION=20.9.0
ARG PLAYWRIGHT_VERSION
ARG IMAGE_NAME_TEMPLATE=ghcr.io/vercel/next.js-playwright-chromium:v%version%-noble-r1
ENV DEBIAN_FRONTEND=noninteractive
ENV FNM_DIR=/usr/local/share/fnm
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
ENV PATH=/usr/local/share/fnm:$PATH
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
ENV TZ=Etc/UTC
ENV FNM_VERSION=v1.39.0
ENV FNM_SHA256=7807664f39d39fc518da1c35ba0181e4b3267603c4b1dedeb4b5fc6ae440a224
ENV FNM_PATH=/usr/bin/fnm
RUN test -n "${NODE_VERSION}" && \
test -n "${PLAYWRIGHT_VERSION}" && \
apt-get update && \
apt-get install -y --no-install-recommends \
bash \
build-essential \
ca-certificates \
curl \
git \
jq \
openssh-client \
unzip \
wget && \
curl -L --fail --retry 2 -o /tmp/fnm-linux.zip \
"https://github.com/Schniz/fnm/releases/download/$FNM_VERSION/fnm-linux.zip" && \
echo "$FNM_SHA256 /tmp/fnm-linux.zip" | sha256sum --check --status && \
unzip /tmp/fnm-linux.zip fnm -d "$(dirname "$FNM_PATH")" && \
rm /tmp/fnm-linux.zip && \
chmod +x "$FNM_PATH" && \
fnm install "$NODE_VERSION" && \
fnm default "$NODE_VERSION"
# put chrome in a separate layer to get some benefits from parallel pulling
RUN eval "$(fnm env)" && \
npm install -g yarn && \
mkdir -p /ms-playwright /ms-playwright-agent && \
cd /ms-playwright-agent && \
npm init -y && \
npm i "playwright-core@$PLAYWRIGHT_VERSION" && \
npm exec --no -- playwright-core mark-docker-image "$IMAGE_NAME_TEMPLATE" && \
npm exec --no -- playwright-core install --with-deps chromium && \
rm -rf /var/lib/apt/lists/* /ms-playwright-agent ~/.npm && \
chmod -R 777 /ms-playwright && \
useradd --uid 1001 --create-home --shell /bin/bash pwuser && \
chown -R pwuser:pwuser "$FNM_DIR" /home/pwuser
name: build-playwright-chromium-image
on:
workflow_dispatch:
push:
branches:
- canary
paths:
- '.github/images/playwright-chromium/**'
- '.github/workflows/playwright_chromium_image.yml'
- '.github/workflows/build_reusable.yml'
- 'package.json'
permissions:
contents: read
packages: write
env:
IMAGE_NAME: ghcr.io/vercel/next.js-playwright-chromium
IMAGE_REVISION: 1
jobs:
build:
if: github.repository == 'vercel/next.js'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Resolve Playwright version
id: version
run: |
version="$(yq -r '.devDependencies.playwright' package.json)"
node_version="$(yq -r '.env.NODE_LTS_VERSION' .github/workflows/build_reusable.yml)"
if [ -z "$version" ] || [ "$version" = "null" ]; then
echo "Unable to resolve Playwright version from package.json"
exit 1
fi
if [ -z "$node_version" ] || [ "$node_version" = "null" ]; then
echo "Unable to resolve Node.js version from build_reusable.yml"
exit 1
fi
echo "version=${version}" >> "$GITHUB_OUTPUT"
echo "node_version=${node_version}" >> "$GITHUB_OUTPUT"
echo "tag=v${version}-noble-r${IMAGE_REVISION}" >> "$GITHUB_OUTPUT"
- name: Login to GHCR
env:
GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GHCR_USER: ${{ github.actor }}
run: |
echo "$GHCR_TOKEN" | docker login ghcr.io -u "$GHCR_USER" --password-stdin
- name: Build and push Chromium image
env:
IMAGE_TAG: ${{ steps.version.outputs.tag }}
NODE_VERSION: ${{ steps.version.outputs.node_version }}
PLAYWRIGHT_VERSION: ${{ steps.version.outputs.version }}
run: |
docker buildx create --use --name nextjs-playwright-builder
# Keep this GHCR package public: job containers are pulled before any
# workflow step can authenticate to a private registry.
docker buildx build \
--file .github/images/playwright-chromium/Dockerfile \
--build-arg NODE_VERSION="$NODE_VERSION" \
--build-arg PLAYWRIGHT_VERSION="$PLAYWRIGHT_VERSION" \
--build-arg IMAGE_NAME_TEMPLATE="$IMAGE_NAME:v%version%-noble-r$IMAGE_REVISION" \
--tag "$IMAGE_NAME:$IMAGE_TAG" \
--platform linux/amd64 \
--push \
.github/images/playwright-chromium
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment