Skip to content

Build & Push

Build & Push #6

Workflow file for this run

name: Build & Push
on:
workflow_dispatch:
inputs:
tag:
description: "Image tag (e.g. v1.0.0)"
required: true
latest:
description: "Also tag as latest"
type: boolean
default: false
platforms:
description: "Target platforms"
required: false
default: "linux/amd64,linux/arm64"
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
# ── Lint (always) ──────────────────────────────────────────────────────
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Lint Dockerfile (hadolint)
uses: hadolint/hadolint-action@v3.1.0
with:
dockerfile: Dockerfile
ignore: DL3008,DL3013,DL3015,DL3016,DL3059
# ── Build + Push (manual only) ─────────────────────────────────────────
build:
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v4
- name: Fetch ffmpeg static binaries
run: ./scripts/fetch-ffmpeg.sh
- name: Log in to ghcr.io
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Resolve image tags
id: tags
run: |
TAGS="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.tag }}"
if [[ "${{ github.event.inputs.latest }}" == "true" ]]; then
TAGS="${TAGS}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"
fi
echo "value<<EOF" >> "$GITHUB_OUTPUT"
echo "$TAGS" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
platforms: ${{ github.event.inputs.platforms }}
push: true
tags: ${{ steps.tags.outputs.value }}
cache-from: type=gha
cache-to: type=gha,mode=max