images/.github/workflows/build.yml
Snider dafabd714c feat: initial core-images repository
Consolidated container image definitions for the host-uk ecosystem,
producing both Docker images and TIM bundles from a single source.

Images:
- developer: Full-fat dev environment with Claude Code CLI, PHP 8.4,
  Node.js, Go, Python, and 100+ tools (ghcr.io/host-uk/core-dev)
- server-php: Production Alpine + Nginx + PHP-FPM with multi-stage
  builds for dev/prod targets (ghcr.io/host-uk/server-php)

Includes:
- Taskfile for local builds (docker + tim)
- GitHub Actions workflow for multi-arch builds
- Borgfiles for future TIM bundle generation

Consolidates docker-developer and docker-server-php repositories.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 17:27:17 +00:00

106 lines
3 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 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