Skip to content

fix: Pin base image version #1

fix: Pin base image version

fix: Pin base image version #1

Workflow file for this run

---
name: Build and test container image
on:
pull_request:
branches:
- main
paths:
- 'verlihub/**'
workflow_dispatch:
jobs:
create-runners:
name: Create self-hosted runner
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 1
matrix:
container: [verlihub]
steps:
- name: Create self-hosted runner
uses: MattKobayashi/tailscale-runner-action@v1.1.1
with:
gh-app-id: ${{ secrets.GH_APP_ID }}
gh-app-login: MattKobayashi
gh-app-private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
runner-network: mattflix
ssh-host: 100.102.37.118
ssh-user: matthew
ts-oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
ts-oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
ts-tag: ci
build-setup:
name: Set up build environment
runs-on: ubuntu-latest
outputs:
repo-owner: ${{ steps.repo-lowercase.outputs.REPO_OWNER }}
steps:
- name: Convert repository owner name to lowercase
id: repo-lowercase
run: |
echo "REPO_OWNER=${GITHUB_REPOSITORY_OWNER,,}" >> $GITHUB_OUTPUT
build-test:
name: Build and test image
runs-on: self-hosted
needs: [create-runners, build-setup]
strategy:
fail-fast: false
max-parallel: 1
matrix:
container: [verlihub]
steps:
# Checkout repository
# https://github.com/actions/checkout
- name: Checkout repository
uses: actions/checkout@v4.2.1
# Set up QEMU
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3.2.0
# Set up Docker Buildx
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.7.1
with:
buildkitd-config-inline: |
[registry."docker.io"]
mirrors = ["registry-mirror:5000"]
[registry."registry-mirror:5000"]
http = true
driver-opts: |
network=mattflix
# Build and export image to Docker daemon
# https://github.com/docker/build-push-action
- name: Build and export to Docker
id: build-export
uses: docker/build-push-action@v6.9.0
with:
context: ${{ github.workspace }}/${{ matrix.container }}
load: true
tags: "${{ needs.build-setup.outputs.repo-owner }}/${{ matrix.container }}:test"
# Test the built image
- name: Test image
run: |
set -x
timeout --kill-after=30s --preserve-status 30s \
docker container run --attach stdout --attach stderr --init --rm ${{ needs.build-setup.outputs.repo-owner }}/${{ matrix.container }}:test
# Remove the test image
- name: Remove test image
if: ${{ !cancelled() }}
run: |
set -x
docker image rm --force ${{ steps.build-export.outputs.imageid }}