Skip to content

Add local ffmpeg and MediaMTX builds to Docker #136

Add local ffmpeg and MediaMTX builds to Docker

Add local ffmpeg and MediaMTX builds to Docker #136

name: MediaMTX Docker build
on:
pull_request:
branches:
- master
paths:
- 'docker/*mediamtx*'
push:
branches:
- master
paths:
- 'docker/*mediamtx*'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
mediamtx:
name: MediaMTX docker build
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
permissions:
packages: write
contents: read
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4.1.7
with:
fetch-depth: 0
# Check https://github.com/livepeer/go-livepeer/pull/1891
# for ref value discussion
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.CI_DOCKERHUB_USERNAME }}
password: ${{ secrets.CI_DOCKERHUB_TOKEN }}
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Extract metadata (tags, labels) for image
id: meta
uses: docker/metadata-action@v5
with:
images: |
livepeerci/mediamtx
ghcr.io/${{ github.repository }}/mediamtx
tags: |
type=sha
type=ref,event=pr
type=ref,event=tag
type=sha,format=long
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=${{ github.event.pull_request.head.ref }}
- name: Build and push
uses: docker/build-push-action@v5
with:
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
file: "docker/Dockerfile.mediamtx"
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
context: docker/