Skip to content

chore(apps/actions-runner-controller): use ubuntu 22.04 base image #10

chore(apps/actions-runner-controller): use ubuntu 22.04 base image

chore(apps/actions-runner-controller): use ubuntu 22.04 base image #10

name: Build Actions Runner Images
on:
push:
branches:
- main
paths:
- apps/actions-runner-controller/runners/**
schedule:
- cron: "0 0 * * 0"
env:
REGISTRY: ghcr.io
jobs:
build-matrix:
name: Build Matrix
runs-on: self-hosted
outputs:
contexts: ${{ steps.find-dockerfiles.outputs.contexts }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Find all Dockerfiles to build
id: find-dockerfiles
run: |
CONTEXTS=$(find apps/actions-runner-controller/runners \
-name Dockerfile -printf '%h\n' | \
jq -R -s -c 'split("\n")[:-1]')
echo "contexts=${CONTEXTS}" >> "${GITHUB_OUTPUT}"
build-image:
name: Build Image
runs-on: self-hosted
needs:
- build-matrix
permissions:
contents: read
packages: write
strategy:
matrix:
context: ${{ fromJSON(needs.build-matrix.outputs.contexts) }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build image name
id: image-name
env:
context: ${{ matrix.context }}
run: |
echo "name=${context#apps/actions-runner-controller/runners/}" >> "${GITHUB_OUTPUT}"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker login
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build and push
uses: docker/build-push-action@v4
with:
context: ${{ matrix.context }}
push: true
tags: ${{ env.REGISTRY }}/invakid404/runners/${{ steps.image-name.outputs.name }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max