Skip to content

馃悰 fix(runners): prevent SIGTERM on docker restart during cloud-init #9

馃悰 fix(runners): prevent SIGTERM on docker restart during cloud-init

馃悰 fix(runners): prevent SIGTERM on docker restart during cloud-init #9

name: Build Fireteact
on:
workflow_dispatch:
inputs:
version:
description: "Version tag (e.g., 0.1.0)"
required: true
default: "0.1.0"
push:
tags:
- "fireteact/v*" # Matches: fireteact/v0.1.0
branches:
- main
paths:
- "fireteact/**"
- ".github/workflows/build-fireteact.yml"
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository_owner }}/fireteact
jobs:
# Extract version from trigger
prepare:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.meta.outputs.version }}
image_name: ${{ steps.meta.outputs.image_name }}
commit: ${{ steps.meta.outputs.commit }}
date: ${{ steps.meta.outputs.date }}
steps:
- name: Determine version
id: meta
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
VERSION="${{ github.event.inputs.version }}"
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
# Extract from tag: fireteact/v0.1.0 -> 0.1.0
TAG="${GITHUB_REF#refs/tags/}"
VERSION="${TAG#fireteact/v}"
else
# Default for push to main (paths trigger)
VERSION="latest"
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "image_name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" >> $GITHUB_OUTPUT
echo "commit=${GITHUB_SHA::8}" >> $GITHUB_OUTPUT
echo "date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_OUTPUT
# Build on native runners for each architecture
build:
needs: prepare
runs-on: ${{ matrix.runner }}
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-latest
platform: linux/amd64
arch: amd64
- runner: ubuntu-24.04-arm
platform: linux/arm64
arch: arm64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push by digest
id: build
uses: docker/build-push-action@v6
with:
context: fireteact
file: fireteact/Dockerfile
target: production
platforms: ${{ matrix.platform }}
push: true
build-args: |
VERSION=${{ needs.prepare.outputs.version }}
COMMIT=${{ needs.prepare.outputs.commit }}
DATE=${{ needs.prepare.outputs.date }}
outputs: type=image,name=${{ needs.prepare.outputs.image_name }},push-by-digest=true,name-canonical=true
cache-from: type=gha,scope=fireteact-${{ matrix.arch }}
cache-to: type=gha,mode=max,scope=fireteact-${{ matrix.arch }}
labels: |
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.version=${{ needs.prepare.outputs.version }}
org.opencontainers.image.title=fireteact
org.opencontainers.image.description=Gitea Actions runner orchestrator for Firecracker microVMs
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: fireteact-digests-${{ matrix.arch }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
# Create multi-arch manifest
manifest:
needs: [prepare, build]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Download digests
uses: actions/download-artifact@v4
with:
path: /tmp/digests
pattern: fireteact-digests-*
merge-multiple: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create manifest list and push
working-directory: /tmp/digests
run: |
IMAGE_NAME="${{ needs.prepare.outputs.image_name }}"
VERSION="${{ needs.prepare.outputs.version }}"
# Build tags array
TAGS="-t ${IMAGE_NAME}:${VERSION}"
if [[ "${VERSION}" != "latest" ]]; then
TAGS="${TAGS} -t ${IMAGE_NAME}:latest"
fi
# Create and push manifest
docker buildx imagetools create ${TAGS} \
$(printf "${IMAGE_NAME}@sha256:%s " *)
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ needs.prepare.outputs.image_name }}:${{ needs.prepare.outputs.version }}
- name: Summary
run: |
echo "## Fireteact Published" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Image:** \`${{ needs.prepare.outputs.image_name }}\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Tags:**" >> $GITHUB_STEP_SUMMARY
echo "- \`${{ needs.prepare.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
if [[ "${{ needs.prepare.outputs.version }}" != "latest" ]]; then
echo "- \`latest\`" >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Architectures:** \`amd64\`, \`arm64\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Build Info:**" >> $GITHUB_STEP_SUMMARY
echo "- Commit: \`${{ needs.prepare.outputs.commit }}\`" >> $GITHUB_STEP_SUMMARY
echo "- Date: \`${{ needs.prepare.outputs.date }}\`" >> $GITHUB_STEP_SUMMARY