ci: automate build of Docker image for running CI

#3
This commit is contained in:
Kirill Gavrilov 2025-10-19 23:19:50 +03:00
parent 6369bb2d62
commit e27b30584a

View file

@ -0,0 +1,62 @@
name: Docker image for CI
on:
push:
branches:
- main
paths:
- '.github/workflows/build-ci-runner-image.yml'
- 'docker/ci-runner.Dockerfile'
workflow_dispatch:
inputs:
nodejs_version:
description: 'Node.js version to use'
type: string
required: true
debian_version:
description: 'Debian codename version to use'
type: string
required: true
env:
NODEJS_VERSION: ${{ inputs.nodejs_version || '22' }}
DEBIAN_VERSION: ${{ inputs.debian_version || 'trixie' }}
IMAGE_NAME: ghcr.io/${{ github.repository }}/ci-runner
DOCKERFILE_PATH: docker/ci-runner.Dockerfile
jobs:
build:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare metadata for tags and labels
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=raw,value=node-${{ env.NODEJS_VERSION }}-${{ env.DEBIAN_VERSION }}-slim
labels: |
org.opencontainers.image.title: Obsidian plugins CI runner
org.opencontainers.image.description=Docker image for building and testing obsidian plugins (with E2E tests support)
- name: Build and push
uses: docker/build-push-action@v6
with:
file: ${{ env.DOCKERFILE_PATH }}
build-args: |
NODEJS_VERSION=${{ env.NODEJS_VERSION }}
DEBIAN_VERSION=${{ env.DEBIAN_VERSION }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}