Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add local ffmpeg and MediaMTX builds to Docker #3353

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
11 changes: 8 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ENV GOARCH="$TARGETARCH" \
CGO_LDFLAGS="-L/usr/local/cuda_${TARGETARCH}/lib64"

RUN apt update \
&& apt install -yqq software-properties-common curl apt-transport-https lsb-release yasm \
&& apt install -yqq software-properties-common curl apt-transport-https lsb-release nasm \
&& curl -fsSL https://dl.google.com/go/go1.21.5.linux-${BUILDARCH}.tar.gz | tar -C /usr/local -xz \
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \
&& add-apt-repository "deb [arch=${BUILDARCH}] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
Expand All @@ -30,6 +30,11 @@ RUN GRPC_HEALTH_PROBE_VERSION=v0.3.6 \
&& chmod +x /usr/bin/grpc_health_probe \
&& ldconfig /usr/local/lib

RUN FFMPEG_SHA=b76053d8bf322b197a9d07bd27bbdad14fd5bc15 git clone --depth 1 https://git.ffmpeg.org/ffmpeg.git /ffmpeg \
&& cd /ffmpeg && git fetch --depth 1 origin ${FFMPEG_SHA} \
&& git checkout ${FFMPEG_SHA} \
&& ./configure --prefix=build && make -j"$(nproc)" && make install

ENV GOPATH=/go \
GO_BUILD_DIR=/build/ \
GOFLAGS="-mod=readonly"
Expand Down Expand Up @@ -67,7 +72,7 @@ COPY --from=build /build/ /usr/local/bin/
COPY --from=build /usr/bin/grpc_health_probe /usr/local/bin/grpc_health_probe
COPY --from=build /src/tasmodel.pb /tasmodel.pb
COPY --from=build /usr/share/misc/pci.ids /usr/share/misc/pci.ids

RUN apt update && apt install -yqq ffmpeg
COPY --from=build /ffmpeg/build/ /usr/local
RUN ldconfig /usr/local/lib

ENTRYPOINT ["/usr/local/bin/livepeer"]
33 changes: 24 additions & 9 deletions docker/Dockerfile.mediamtx
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
FROM golang:1.23 AS builder

# Install any build dependencies (e.g., git)
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
&& rm -rf /var/lib/apt/lists/*

# Temporarily use this branch while we have changes waiting for upstream
WORKDIR /app
RUN git clone --branch v1.11.2-livepeer-1 https://github.com/livepeer/mediamtx.git .

# Download Go dependencies
RUN go mod download

# Disable CGO
ENV CGO_ENABLED=0

# Generate code and build
RUN go generate ./...
RUN go build -o mediamtx

FROM ubuntu:24.04

# we need curl in the image as it's later used in the runOnReady command
Expand All @@ -18,14 +39,8 @@ RUN mkdir -p /var/log/ \

COPY --chmod=0755 mediamtx-metrics.bash /opt/mediamtx-metrics.bash

ENV MEDIAMTX_VERSION="1.9.3"

ADD "https://github.com/bluenviron/mediamtx/releases/download/v${MEDIAMTX_VERSION}/mediamtx_v${MEDIAMTX_VERSION}_linux_amd64.tar.gz" /opt/mediamtx/mediamtx.tar.gz

RUN tar xzf /opt/mediamtx/mediamtx.tar.gz -C /opt/mediamtx/ \
&& mkdir -p /usr/local/bin /etc/mediamtx/ \
&& mv /opt/mediamtx/mediamtx /usr/local/bin/mediamtx \
&& mv /opt/mediamtx/mediamtx.yml /etc/mediamtx/mediamtx.yml \
&& rm -rf /opt/mediamtx/
# Copy artifacts from the builder stage
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is temporary, should we put the removed snippet as comments instead of deleting completely?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and update the MEDIAMTX_VERSION with v1.11.2-livepeer-1 as we track that version field for alerts in deployments/version mismatches.

COPY --from=builder /app/mediamtx /usr/local/bin/mediamtx
COPY --from=builder /app/mediamtx.yml /etc/mediamtx/mediamtx.yml

CMD [ "/bin/bash", "-c", "declare -p >> /etc/environment && cron && /usr/local/bin/mediamtx" ]
Loading