Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.git
.github
__pycache__
*.pyc
.DS_Store
*.md
!README.md
!CONTRIBUTING.md
.pre-commit-config.yaml
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
191 changes: 191 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
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@v4
- uses: actions/setup-python@v5
with:
python-version: "3.14"
- run: pip install pre-commit packaging
- uses: actions/cache@v4
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@v4
- 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@v4
- uses: docker/setup-buildx-action@v4
- uses: docker/login-action@v4
if: github.event_name == 'push'
with:
username: ${{ secrets.DOCKER_LOGIN }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: docker/login-action@v4
if: github.event_name == 'push'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v6
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@v6
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@v4
- name: Sync README 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
- uses: actions/configure-pages@v5
- uses: actions/jekyll-build-pages@v1
with:
source: ./docs
destination: ./_site
- uses: actions/upload-pages-artifact@v3
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5
49 changes: 49 additions & 0 deletions .github/workflows/jekyll-gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Deploy Jekyll with GitHub Pages dependencies preinstalled

on:
push:
branches: ["main"]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Sync README and CONTRIBUTING to docs
run: |
mkdir -p docs
printf -- '---\n---\n\n' > docs/index.md
cat README.md >> docs/index.md
printf -- '---\ntitle: Contributing\n---\n\n' > docs/contributing.md
cat CONTRIBUTING.md >> docs/contributing.md
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./docs
destination: ./_site
- name: Upload artifact
uses: actions/upload-pages-artifact@v3

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,6 @@ venv.bak/
# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
Expand All @@ -165,3 +163,6 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
docs/index.md # Generated
docs/_site
docs/.jekyll-cache
5 changes: 4 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ pre-commit:
- docker:19-dind
before_script:
- export IMAGE="ffmpeg:${VERSION}-${VARIANT:-ubuntu}"
- docker run --rm --privileged tonistiigi/binfmt --install all
- docker buildx create --name multiarch --driver docker-container --use
- docker buildx inspect --bootstrap
script:
- docker build -t "${IMAGE}" --build-arg MAKEFLAGS="-j$(($(nproc) + 1))" docker-images/${VERSION}/${VARIANT}
- docker buildx build --platform ${PLATFORMS} -t "${IMAGE}" --build-arg MAKEFLAGS="-j$(($(nproc) + 1))" docker-images/${VERSION}/${VARIANT}
- docker images
after_script:
- docker run --rm ${IMAGE} -buildconf
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ repos: # pre-commit autoupdate
[--in-place, --remove-all-unused-imports, --remove-unused-variables]

- repo: https://github.com/pycqa/isort
rev: 8.0.1
rev: 9.0.0a3
hooks:
- id: isort

Expand Down
13 changes: 12 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Welcome to ffmpeg docker image contributing guide <!-- omit in toc -->

Thank you for investing your time in contributing to our project! Any contribution you make will be reflected on [jrottenberg/ffmpeg](https://github.com/jrottenberg/ffmpeg) :tada:.
Thank you for investing your time in contributing to our project! Any contribution you make will be reflected on [jrottenberg/ffmpeg](https://github.com/jrottenberg/ffmpeg) 🎉.

Read our [Code of Conduct](./CODE_OF_CONDUCT.md) to keep our community approachable and respectable.

Expand Down Expand Up @@ -123,6 +123,17 @@ In the bash shell, run the following commands
```
</details>

## Previewing GitHub Pages locally

The project site is built from `README.md` using Jekyll. To preview it locally:

```sh
docker build -t docs -f docs/Dockerfile .
docker run --rm -p 4000:4000 docs
```

Then open http://localhost:4000.

# Reviewing


Expand Down
Loading
Loading