diff --git a/docker/Dockerfile b/docker/Dockerfile index d9a263591..33e64fb89 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -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" \ @@ -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" @@ -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"] diff --git a/docker/Dockerfile.mediamtx b/docker/Dockerfile.mediamtx index 80abe0dcc..d14a71cc5 100644 --- a/docker/Dockerfile.mediamtx +++ b/docker/Dockerfile.mediamtx @@ -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 @@ -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 --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" ]