Skip to content

Release 8.0.2 & 8.1.1 (#457) #57

Release 8.0.2 & 8.1.1 (#457)

Release 8.0.2 & 8.1.1 (#457) #57

Workflow file for this run

name: Build Docker Images
on:
push:
paths:
- 'docker-images/**'
- 'templates/**'
- '.github/workflows/build.yml'
pull_request:
paths:
- 'docker-images/**'
- 'templates/**'
- '.github/workflows/build.yml'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
permissions:
contents: read
packages: write
pages: write
id-token: write
env:
DOCKER: jrottenberg/ffmpeg
GHCR: ghcr.io/jrottenberg/ffmpeg
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.14"
- run: pip install pre-commit packaging
- uses: actions/cache@v5
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
- run: pre-commit run --all-files --show-diff-on-failure
generate-matrix:
runs-on: ubuntu-latest
outputs:
build: ${{ steps.matrix.outputs.build }}
manifest: ${{ steps.matrix.outputs.manifest }}
steps:
- uses: actions/checkout@v6
- id: matrix
run: |
echo "build=$(jq -c '.build' docker-images/github-actions-matrix.json)" >> "$GITHUB_OUTPUT"
echo "manifest=$(jq -c '.manifest' docker-images/github-actions-matrix.json)" >> "$GITHUB_OUTPUT"
build:
needs: [lint, generate-matrix]
runs-on: ${{ matrix.runner }}
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.generate-matrix.outputs.build) }}
steps:
- uses: actions/checkout@v6
- uses: docker/setup-buildx-action@v4
- uses: docker/login-action@v4
if: github.event.pull_request.head.repo.full_name == github.repository || github.event_name != 'pull_request'
with:
username: ${{ secrets.DOCKER_LOGIN }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: docker/login-action@v4
if: github.event.pull_request.head.repo.full_name == github.repository || github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v7
with:
context: docker-images/${{ matrix.version }}/${{ matrix.variant }}
platforms: ${{ matrix.platform }}
push: ${{ github.event_name == 'push' }}
tags: |
${{ env.DOCKER }}:${{ matrix.long_version }}-${{ matrix.variant }}-${{ matrix.arch }}
${{ env.GHCR }}:${{ matrix.long_version }}-${{ matrix.variant }}-${{ matrix.arch }}
cache-from: type=gha,scope=${{ matrix.version }}-${{ matrix.variant }}-${{ matrix.arch }}
cache-to: type=gha,mode=max,scope=${{ matrix.version }}-${{ matrix.variant }}-${{ matrix.arch }}
- name: Load image for smoke test
uses: docker/build-push-action@v7
with:
context: docker-images/${{ matrix.version }}/${{ matrix.variant }}
load: true
tags: smoke-test:latest
cache-from: type=gha,scope=${{ matrix.version }}-${{ matrix.variant }}-${{ matrix.arch }}
- name: Smoke test
run: |
docker run --rm smoke-test:latest -version
docker run --rm smoke-test:latest -buildconf
CODECS=$(docker run --rm smoke-test:latest -codecs)
for codec in libx264 libx265 libvpx libopus; do
echo "Checking $codec..."
echo "$CODECS" | grep -q "$codec" || { echo "MISSING: $codec"; exit 1; }
done
echo "All codec checks passed"
create-manifests:
if: github.event_name == 'push'
needs: [build, generate-matrix]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.generate-matrix.outputs.manifest) }}
steps:
- uses: docker/setup-buildx-action@v4
- uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKER_LOGIN }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create multi-arch manifests
env:
PLATFORMS: ${{ matrix.platforms }}
VARIANT: ${{ matrix.variant }}
PARENT: ${{ matrix.parent }}
VERSION: ${{ matrix.version }}
LONG_VERSION: ${{ matrix.long_version }}
MAJOR_VERSION: ${{ matrix.major_version }}
ISPARENT: ${{ matrix.is_parent }}
ISLATEST: ${{ matrix.is_latest }}
run: |
DOCKER_SOURCES=""
GHCR_SOURCES=""
IFS=',' read -ra ARCHS <<< "${PLATFORMS}"
for platform in "${ARCHS[@]}"; do
arch="${platform#linux/}"
DOCKER_SOURCES="${DOCKER_SOURCES} ${{ env.DOCKER }}:${LONG_VERSION}-${VARIANT}-${arch}"
GHCR_SOURCES="${GHCR_SOURCES} ${{ env.GHCR }}:${LONG_VERSION}-${VARIANT}-${arch}"
done
DOCKER_TAGS="${{ env.DOCKER }}:${VERSION}-${VARIANT} ${{ env.DOCKER }}:${LONG_VERSION}-${VARIANT}"
GHCR_TAGS="${{ env.GHCR }}/${VERSION}-${VARIANT} ${{ env.GHCR }}/${LONG_VERSION}-${VARIANT}"
if [ "${ISPARENT}" == "True" ] && [ "${VARIANT}" != "${PARENT}" ]; then
DOCKER_TAGS="${DOCKER_TAGS} ${{ env.DOCKER }}:${VERSION}-${PARENT} ${{ env.DOCKER }}:${MAJOR_VERSION}-${PARENT}"
GHCR_TAGS="${GHCR_TAGS} ${{ env.GHCR }}:${VERSION}-${PARENT} ${{ env.GHCR }}:${MAJOR_VERSION}-${PARENT}"
fi
if [ "${ISLATEST}" == "True" ]; then
DOCKER_TAGS="${DOCKER_TAGS} ${{ env.DOCKER }}:latest"
GHCR_TAGS="${GHCR_TAGS} ${{ env.GHCR }}:latest"
fi
for tag in ${DOCKER_TAGS}; do
docker buildx imagetools create -t "${tag}" ${DOCKER_SOURCES}
done
for tag in ${GHCR_TAGS}; do
docker buildx imagetools create -t "${tag}" ${GHCR_SOURCES}
done
deploy-docs:
if: github.event_name != 'pull_request'
needs: [lint]
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v6
- name: Sync README and CONTRIBUTING to docs
run: |
mkdir -p docs
printf -- '---\nlayout: default\ntitle: FFmpeg Docker Images\n---\n\n' > docs/index.md
cat README.md >> docs/index.md
printf -- '---\nlayout: default\ntitle: Contributing\n---\n\n' > docs/contributing.md
cat CONTRIBUTING.md >> docs/contributing.md
- uses: actions/configure-pages@v6
- uses: actions/jekyll-build-pages@v1
with:
source: ./docs
destination: ./_site
- uses: actions/upload-pages-artifact@v5
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5