Skip to content

fix(EdgedriverBinary): generate per-platform URLs, drop dead listing API #721

fix(EdgedriverBinary): generate per-platform URLs, drop dead listing API

fix(EdgedriverBinary): generate per-platform URLs, drop dead listing API #721

Workflow file for this run

# https://docs.github.com/en/actions/tutorials/publish-packages/publish-docker-images#publishing-images-to-github-packages
name: Create and publish a Docker image
# Configures this workflow to run manually
on:
workflow_dispatch:
pull_request:
branches: [master]
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
jobs:
build-and-push-image:
runs-on: ubuntu-latest
concurrency:
group: build-and-push-image-${{ github.workflow }}-#${{ github.event.pull_request.number || github.head_ref || github.ref }}
cancel-in-progress: true
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
packages: write
attestations: write
id-token: write
services:
mysql:
image: mysql:9
env:
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
MYSQL_DATABASE: cnpmcore
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
redis:
image: redis
ports:
- 6379:6379
steps:
- name: Checkout repository
uses: actions/checkout@v6
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
- name: Log in to the Container registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v6
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Prepare database
run: CNPMCORE_TEST_WORKERS=0 CNPMCORE_DATABASE_NAME=cnpmcore bash ./prepare-database-mysql.sh
# Build and test debian image
- name: Build debian image for testing
uses: docker/build-push-action@v7
with:
context: .
file: .docker/debian/Dockerfile
platforms: linux/amd64
load: true
tags: cnpmcore:test-debian
- name: Verify debian image
run: |
docker run -d --rm --name cnpmcore-debian \
--network host \
-e NODE_ENV=production \
-e EGG_SERVER_ENV=prod \
-e CNPMCORE_CONFIG_REGISTRY=http://localhost:7001 \
-e CNPMCORE_DATABASE_TYPE=MySQL \
-e CNPMCORE_DATABASE_HOST=127.0.0.1 \
-e CNPMCORE_DATABASE_PORT=3306 \
-e CNPMCORE_DATABASE_NAME=cnpmcore \
-e CNPMCORE_DATABASE_USER=root \
-e CNPMCORE_DATABASE_PASSWORD= \
-e CNPMCORE_REDIS_HOST=127.0.0.1 \
-e CNPMCORE_REDIS_PORT=6379 \
-e CNPMCORE_REDIS_DB=0 \
-e CNPMCORE_NFS_TYPE= \
-e CNPMCORE_FORCE_LOCAL_FS=true \
cnpmcore:test-debian
bash .docker/health-check.sh cnpmcore-debian
# Build and test alpine image
- name: Build alpine image for testing
uses: docker/build-push-action@v7
with:
context: .
file: .docker/alpine/Dockerfile
platforms: linux/amd64
load: true
tags: cnpmcore:test-alpine
- name: Verify alpine image
run: |
docker run -d --rm --name cnpmcore-alpine \
--network host \
-e NODE_ENV=production \
-e EGG_SERVER_ENV=prod \
-e CNPMCORE_CONFIG_REGISTRY=http://localhost:7001 \
-e CNPMCORE_DATABASE_TYPE=MySQL \
-e CNPMCORE_DATABASE_HOST=127.0.0.1 \
-e CNPMCORE_DATABASE_PORT=3306 \
-e CNPMCORE_DATABASE_NAME=cnpmcore \
-e CNPMCORE_DATABASE_USER=root \
-e CNPMCORE_DATABASE_PASSWORD= \
-e CNPMCORE_REDIS_HOST=127.0.0.1 \
-e CNPMCORE_REDIS_PORT=6379 \
-e CNPMCORE_REDIS_DB=0 \
-e CNPMCORE_NFS_TYPE= \
-e CNPMCORE_FORCE_LOCAL_FS=true \
cnpmcore:test-alpine
bash .docker/health-check.sh cnpmcore-alpine
# Build multi-platform and push (only on non-PR events)
- name: Build and push Docker image
id: push
if: github.event_name != 'pull_request'
uses: docker/build-push-action@v7
with:
context: .
file: .docker/debian/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# This step generates an artifact attestation for the image, which is a tamper-proof statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see [Using artifact attestations to establish provenance for builds](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds).
- name: Generate artifact attestation
if: github.event_name != 'pull_request'
uses: actions/attest-build-provenance@v4
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true