Add LinuxKit configurations for developer and server-php images: - developer/linuxkit.yml: Full dev environment with Docker-in-LinuxKit - server-php/linuxkit.yml: Nginx + PHP-FPM production server Update CI workflow to build LinuxKit images using `core build --type linuxkit` instead of raw linuxkit CLI commands for consistency across the ecosystem. Builds produce qcow2 and ISO formats for both amd64 and arm64 architectures. Release artifacts are uploaded to GitHub Releases on version tags. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
190 lines
5.5 KiB
YAML
190 lines
5.5 KiB
YAML
name: Build Images
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
tags: ['v*']
|
|
pull_request:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
REGISTRY: ghcr.io
|
|
|
|
jobs:
|
|
# ============================================================
|
|
# Build Docker Images
|
|
# ============================================================
|
|
docker:
|
|
name: Docker (${{ matrix.image }})
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
strategy:
|
|
matrix:
|
|
image:
|
|
- developer
|
|
- server-php
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to GHCR
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Extract metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.REGISTRY }}/host-uk/${{ matrix.image == 'developer' && 'core-dev' || matrix.image }}
|
|
tags: |
|
|
type=ref,event=branch
|
|
type=ref,event=pr
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=raw,value=latest,enable={{is_default_branch}}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: ./${{ matrix.image }}
|
|
platforms: linux/amd64,linux/arm64
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
|
|
# ============================================================
|
|
# Build LinuxKit Images
|
|
# ============================================================
|
|
linuxkit:
|
|
name: LinuxKit (${{ matrix.image }}-${{ matrix.arch }})
|
|
runs-on: ubuntu-latest
|
|
needs: docker # Needs Docker images to be built first
|
|
|
|
strategy:
|
|
matrix:
|
|
image: [developer, server-php]
|
|
arch: [amd64, arm64]
|
|
format: [qcow2-bios, iso-bios]
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Core CLI
|
|
run: |
|
|
# Download latest core binary
|
|
curl -fsSL "https://github.com/host-uk/core/releases/latest/download/core-linux-amd64.tar.gz" -o core.tar.gz
|
|
tar -xzf core.tar.gz
|
|
sudo mv core /usr/local/bin/core
|
|
chmod +x /usr/local/bin/core
|
|
core --version
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Login to GHCR
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build LinuxKit Image
|
|
run: |
|
|
mkdir -p dist
|
|
core build --type linuxkit \
|
|
--config ./${{ matrix.image }}/linuxkit.yml \
|
|
--format ${{ matrix.format }} \
|
|
--arch ${{ matrix.arch }} \
|
|
-o ./dist/${{ matrix.image == 'developer' && 'core-dev' || matrix.image }}-${{ matrix.arch }}
|
|
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ matrix.image == 'developer' && 'core-dev' || matrix.image }}-${{ matrix.arch }}-${{ matrix.format }}
|
|
path: ./dist/*
|
|
|
|
# ============================================================
|
|
# Release LinuxKit Images
|
|
# ============================================================
|
|
release-linuxkit:
|
|
name: Release LinuxKit Images
|
|
runs-on: ubuntu-latest
|
|
needs: linuxkit
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
permissions:
|
|
contents: write
|
|
|
|
steps:
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: ./dist
|
|
merge-multiple: true
|
|
|
|
- name: Generate checksums
|
|
run: |
|
|
cd dist
|
|
sha256sum * > checksums.txt
|
|
|
|
- name: Upload to Release
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
files: |
|
|
dist/*
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
# ============================================================
|
|
# Build TIM Bundles (when core build --type tim is ready)
|
|
# ============================================================
|
|
# tim:
|
|
# name: TIM (${{ matrix.image }})
|
|
# runs-on: ubuntu-latest
|
|
# needs: docker
|
|
#
|
|
# strategy:
|
|
# matrix:
|
|
# image: [developer, server-php]
|
|
# os: [linux, darwin]
|
|
# arch: [amd64, arm64]
|
|
#
|
|
# steps:
|
|
# - uses: actions/checkout@v4
|
|
#
|
|
# - name: Install Core
|
|
# run: |
|
|
# curl -fsSL https://github.com/host-uk/core/releases/latest/download/core-linux-amd64 -o /usr/local/bin/core
|
|
# chmod +x /usr/local/bin/core
|
|
#
|
|
# - name: Build TIM
|
|
# run: |
|
|
# core build --type tim \
|
|
# --borgfile ./${{ matrix.image }}/Borgfile \
|
|
# --os ${{ matrix.os }} \
|
|
# --arch ${{ matrix.arch }} \
|
|
# -o ./dist/${{ matrix.image }}-${{ matrix.os }}-${{ matrix.arch }}.tim
|
|
#
|
|
# - name: Upload artifact
|
|
# uses: actions/upload-artifact@v4
|
|
# with:
|
|
# name: ${{ matrix.image }}-${{ matrix.os }}-${{ matrix.arch }}
|
|
# path: ./dist/*.tim
|