Skip to content

Build Mock Runner Image #9

Build Mock Runner Image

Build Mock Runner Image #9

name: Build Mock Runner Image
# Builds and pushes ghcr.io/tuna-os/mock-runner:centos-stream-10
on:
push:
branches: [main]
paths:
- 'mock/Containerfile'
- 'mock/centos-stream-10-ci.cfg'
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE: ghcr.io/tuna-os/mock-runner
TAG: centos-stream-10
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to GHCR
run: |
echo "${{ secrets.GITHUB_TOKEN }}" \
| podman login ghcr.io -u "${{ github.actor }}" --password-stdin
- name: Build image
run: |
# mock --init inside a RUN layer needs SYS_ADMIN + SYS_CHROOT.
# podman build doesn't support --privileged; use --cap-add=all
# with sudo so the runner process has the needed kernel capabilities.
sudo podman build \
--cap-add=all \
--security-opt label=disable \
--pull=always \
-f mock/Containerfile \
-t "${IMAGE}:${TAG}" \
-t "${IMAGE}:${TAG}-${{ github.sha }}" \
mock/
- name: Push image
run: |
sudo podman push "${IMAGE}:${TAG}"
sudo podman push "${IMAGE}:${TAG}-${{ github.sha }}"
- name: Inspect
run: sudo podman images "${IMAGE}:${TAG}" --format "{{.Repository}}:{{.Tag}} {{.Size}}"