Merge pull request #691 from jb-alvarado/master

update docker
This commit is contained in:
jb-alvarado 2024-07-05 13:28:47 +00:00 committed by GitHub
commit 3f6018525c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 412 additions and 293 deletions

1
.gitignore vendored
View File

@ -22,6 +22,7 @@
ffplayout.1.gz
/assets/*.db*
/dist/
data/
/public/
tmp/
assets/playlist_template.json

View File

@ -1,22 +1,5 @@
# Run ffplayout in container
## Base Image
Use of [CentOS image](https://hub.docker.com/_/centos) as base image as it offer the possibility to use systemd.
In order to run systemd in a container it has to run in privileged mode and bind to the `cgroup` of the host.
> **_NOTE:_** A system with CGroup V2 is need!
> Currently tested host systems are:
> - debian 12 with official docker ce from docker.com
> - Manjaro from 2024 Kernel 6.6+
> - fedora 39 with podman
## Image
In addition to the base image, there is the compilation of ffmpeg and all lib from source based on https://github.com/jrottenberg/ffmpeg.
We can't use directly the image from `jrottenberg/ffmpeg` as it compile ffmpeg with the flag `--enable-small` that remove some part of the json from the ffprobe command.
The image is build with a default user/pass `admin/admin`.
You can take a look at the [Dockerfile](Dockerfile)
@ -29,7 +12,6 @@ There are some folders/files that are important for ffplayout to work well such
- **/usr/share/ffplayout/db** => where all the data are stored (user/pass etc)
- **/var/lib/ffplayout/tv-media** => where the media are stored by default (configurable)
- **/var/lib/ffplayout/playlists** => where playlists are stored (configurable)
- **/etc/ffplayout/ffplayout.yml** => the core config file
It may be useful to create/link volume for those folders/files.
@ -47,10 +29,11 @@ docker build --build-arg SHARED_STORAGE=true .
docker build -f docker/Dockerfile -t ffplayout-image .
# build ffmpeg from source
docker build -f fromSource.Dockerfile -t ffplayout-image:from-source .
docker build -f ffmpeg.Dockerfile -t ffmpeg-build .
docker build -f nonfree.Dockerfile -t ffplayout-image:nonfree .
# build with nvidia image for hardware support
docker build -f nvidia-centos7.Dockerfile -t ffplayout-image:nvidia .
docker build -f nvidia.Dockerfile -t ffplayout-image:nvidia .
```
example of command to start the container:

View File

@ -6,5 +6,11 @@ services:
build:
context: .
dockerfile: ./Dockerfile
volumes:
- ./data/db:/db
- ./data/storage:/tv-media
- ./data/playlists:/playlists
- ./data/logging:/logging
- ./data/hls:/hls
ports:
- '8787:8787'

158
docker/ffmpeg.Dockerfile Normal file
View File

@ -0,0 +1,158 @@
FROM alpine:latest as builder
ENV EXTRA_CFLAGS=-march=generic \
LOCALBUILDDIR=/tmp/build \
LOCALDESTDIR=/tmp/local \
PKG_CONFIG="pkg-config --static" \
PKG_CONFIG_PATH=/tmp/local/lib/pkgconfig \
CPPFLAGS="-I/tmp/local/include -O3 -fno-strict-overflow -fstack-protector-all -fPIC" \
CFLAGS="-I/tmp/local/include -O3 -fno-strict-overflow -fstack-protector-all -fPIC" \
CXXFLAGS="-I/tmp/local/include -O2 -fPIC" \
LDFLAGS="-L/tmp/local/lib -pipe -Wl,-z,relro,-z,now -static" \
CC=clang
RUN apk add --no-cache \
clang \
glib-dev glib-static \
coreutils \
autoconf \
automake \
build-base \
cmake \
git \
libtool \
nasm \
pkgconfig \
yasm \
wget \
curl \
ninja-build \
meson \
cargo cargo-c \
diffutils \
bash
RUN apk add --no-cache \
zlib-dev zlib-static \
bzip2-dev bzip2-static \
expat-dev expat-static \
libxml2-dev libxml2-static \
fontconfig-dev fontconfig-static \
freetype freetype-dev freetype-static \
fribidi-dev fribidi-static \
harfbuzz-dev harfbuzz-static \
graphite2-static \
numactl-dev \
brotli-dev brotli-static \
soxr-dev soxr-static \
libjpeg-turbo libjpeg-turbo-dev \
libpng-dev libpng-static \
xvidcore-dev xvidcore-static \
libsodium-dev libsodium-static \
zeromq-dev libzmq-static \
openssl-dev openssl-libs-static
WORKDIR /tmp
RUN git clone --depth 1 "https://github.com/libass/libass.git" && cd libass && \
./autogen.sh && \
./configure --prefix="$LOCALDESTDIR" --enable-shared=no && \
make -j $(nproc) && \
make install
RUN git clone --depth 1 "https://github.com/mstorsjo/fdk-aac" && cd fdk-aac && \
./autogen.sh && \
./configure --prefix="$LOCALDESTDIR" --enable-shared=no && \
make -j $(nproc) && \
make install
RUN curl --retry 20 --retry-max-time 5 -L -k -f -w "%{response_code}" -o "lame-3.100.tar.gz" "https://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz" && \
tar xf "lame-3.100.tar.gz" && \
cd "lame-3.100" && \
./configure --prefix="$LOCALDESTDIR" --enable-expopt=full --enable-shared=no && \
make -j $(nproc) && \
make install
RUN curl --retry 20 --retry-max-time 5 -L -k -f -w "%{response_code}" -o "opus-1.4.tar.gz" "https://ftp.osuosl.org/pub/xiph/releases/opus/opus-1.4.tar.gz" && \
tar xf "opus-1.4.tar.gz" && \
cd "opus-1.4" && \
./configure --prefix="$LOCALDESTDIR" --enable-shared=no --enable-static --disable-doc && \
make -j $(nproc) && \
make install
RUN git clone --depth 1 "https://github.com/Haivision/srt.git" && cd srt && \
mkdir build && \
cd build && \
cmake .. -DCMAKE_INSTALL_PREFIX="$LOCALDESTDIR" -DENABLE_SHARED:BOOLEAN=OFF -DOPENSSL_USE_STATIC_LIBS=ON -DUSE_STATIC_LIBSTDCXX:BOOLEAN=ON -DENABLE_CXX11:BOOLEAN=ON -DCMAKE_INSTALL_BINDIR="bin" -DCMAKE_INSTALL_LIBDIR="lib" -DCMAKE_INSTALL_INCLUDEDIR="include" && \
make -j $(nproc) && \
make install
RUN git clone "https://github.com/webmproject/libvpx.git" && cd libvpx && \
./configure --prefix="$LOCALDESTDIR" --disable-shared --enable-static --disable-unit-tests --disable-docs --enable-postproc --enable-vp9-postproc --enable-runtime-cpu-detect && \
make -j $(nproc) && \
make install
RUN git clone "https://code.videolan.org/videolan/x264" && cd x264 && \
./configure --prefix="$LOCALDESTDIR" --enable-static && \
make -j $(nproc) && \
make install
RUN git clone "https://bitbucket.org/multicoreware/x265_git.git" && cd x265_git/build && \
cmake ../source -DCMAKE_INSTALL_PREFIX="$LOCALDESTDIR" -DENABLE_SHARED:BOOLEAN=OFF -DCMAKE_CXX_FLAGS_RELEASE:STRING="-O3 -DNDEBUG $CXXFLAGS" && \
make -j $(nproc) && \
make install
RUN git clone "https://github.com/xiph/rav1e.git" && cd rav1e && \
RUSTFLAGS="-C target-feature=+crt-static" cargo cinstall --release --jobs $(nproc) --prefix=$LOCALDESTDIR --libdir=$LOCALDESTDIR/lib --includedir=$LOCALDESTDIR/include
RUN git clone --depth 1 "https://gitlab.com/AOMediaCodec/SVT-AV1.git" && cd SVT-AV1/Build && \
cmake .. -G"Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$LOCALDESTDIR" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_BINDIR="bin" -DCMAKE_INSTALL_LIBDIR="lib" -DCMAKE_INSTALL_INCLUDEDIR="include" && \
make -j $(nproc) && \
make install
RUN git clone --depth 1 "https://code.videolan.org/videolan/dav1d.git" && cd dav1d && \
mkdir build && cd build && \
meson setup -Denable_tools=false -Denable_tests=false --default-library=static .. --prefix "$LOCALDESTDIR" --libdir="$LOCALDESTDIR/lib" && \
ninja && \
ninja install
RUN git clone --depth 1 https://git.ffmpeg.org/ffmpeg.git && cd ffmpeg && \
sed -i 's/add_ldexeflags -fPIE -pie/add_ldexeflags -fPIE -static-pie/' configure && \
./configure \
--pkg-config-flags=--static \
--extra-cflags="-fopenmp -DZMG_STATIC" \
--extra-ldflags="-fopenmp -Wl,--copy-dt-needed-entries -Wl,--allow-multiple-definition" \
--enable-runtime-cpudetect \
--prefix=/usr/local \
--disable-debug \
--disable-doc \
--disable-ffplay \
--disable-shared \
--enable-gpl \
--enable-version3 \
--enable-nonfree \
--enable-small \
--enable-static \
--enable-libass \
--enable-fontconfig \
--enable-libfdk-aac \
--enable-libfribidi \
--enable-libfreetype \
--enable-libharfbuzz \
--enable-libmp3lame \
--enable-libopus \
--enable-libsoxr \
--enable-libsrt \
--enable-libvpx \
--enable-libx264 \
--enable-libx265 \
--enable-libzmq \
--enable-nonfree \
--enable-openssl \
--enable-libsvtav1 \
--enable-librav1e \
--enable-libdav1d \
--enable-libxvid && \
make -j $(nproc) && \
make install
RUN strip /usr/local/bin/ffmpeg /usr/local/bin/ffprobe

View File

@ -1,161 +0,0 @@
FROM almalinux:9 AS base
ENV container docker
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \
systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*; \
rm -f /etc/systemd/system/*.wants/*; \
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*; \
rm -f /lib/systemd/system/anaconda.target.wants/*
FROM base AS build
WORKDIR /tmp/workdir
ENV SRC=/usr/local \
BUILD=/tmp/build
ARG LD_LIBRARY_PATH=/opt/ffmpeg/lib
ARG PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig:/lib64/pkgconfig"
ARG LOCALDESTDIR=/opt/ffmpeg
ARG LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64"
RUN \
buildDeps="bzip2 gperf which libticonv autoconf automake cmake diffutils file gcc \
ninja-build wget nasm gcc-c++ git libtool make perl yasm meson x264-devel zlib-devel \
expat-devel fontconfig-devel libxml2-devel lame-devel libpng-devel numactl-devel \
fribidi-devel zeromq-devel freetype-devel opus-devel libass-devel openssl-devel" && \
echo "${SRC}/lib" > /etc/ld.so.conf.d/libc.conf && \
dnf install -y epel-release && \
dnf install -y 'dnf-command(config-manager)' && \
dnf config-manager --set-enabled crb && \
dnf install -y --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-$(rpm -E %rhel).noarch.rpm && \
dnf install -y --nogpgcheck https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-$(rpm -E %rhel).noarch.rpm && \
dnf install -y ${buildDeps} && \
mkdir -p ${BUILD}
RUN \
cd ${BUILD} && \
git clone --depth 1 "https://github.com/Haivision/srt.git" && \
cd srt && \
mkdir build && \
cd build && \
cmake .. -DCMAKE_INSTALL_PREFIX="$LOCALDESTDIR" -DENABLE_SHARED:BOOLEAN=OFF -DUSE_STATIC_LIBSTDCXX:BOOLEAN=ON \
-DENABLE_CXX11:BOOLEAN=OFF -DCMAKE_INSTALL_BINDIR="bin" -DCMAKE_INSTALL_LIBDIR="lib" -DCMAKE_INSTALL_INCLUDEDIR="include" && \
make -j $(nproc | awk '{print $1 / 2}') && \
make install
RUN \
cd ${BUILD} && \
git clone --depth 1 "https://code.videolan.org/rist/librist.git" && \
cd librist && \
mkdir build && \
cd build && \
meson setup --default-library=static --prefix "$LOCALDESTDIR" --libdir="$LOCALDESTDIR/lib" .. && \
ninja && \
ninja install
RUN \
cd ${BUILD} && \
git clone --depth 1 "https://github.com/mstorsjo/fdk-aac" && \
cd fdk-aac && \
./autogen.sh && \
./configure --prefix="$LOCALDESTDIR" --enable-shared=no && \
make -j $(nproc | awk '{print $1 / 2}') && \
make install
RUN \
cd ${BUILD} && \
git clone --depth 1 "https://gitlab.com/AOMediaCodec/SVT-AV1.git" && \
cd SVT-AV1/Build && \
rm -rf * && \
cmake .. -G"Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$LOCALDESTDIR" -DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_BINDIR="bin" -DCMAKE_INSTALL_LIBDIR="lib" -DCMAKE_INSTALL_INCLUDEDIR="include" && \
make -j $(nproc | awk '{print $1 / 2}') && \
make install
RUN \
cd ${BUILD} && \
git clone --depth 1 "https://code.videolan.org/videolan/dav1d.git" && \
cd dav1d && \
mkdir build && \
cd build && \
meson setup -Denable_tools=false -Denable_tests=false --default-library=static .. --prefix "$LOCALDESTDIR" --libdir="$LOCALDESTDIR/lib" && \
ninja && \
ninja install
RUN \
cd ${BUILD} && \
git clone "https://github.com/webmproject/libvpx.git" && \
cd libvpx && \
./configure --prefix="$LOCALDESTDIR" --disable-shared --enable-static --disable-unit-tests --disable-docs --enable-postproc --enable-vp9-postproc --enable-runtime-cpu-detect && \
make -j $(nproc | awk '{print $1 / 2}') && \
make install
RUN \
cd ${BUILD} && \
git clone "https://bitbucket.org/multicoreware/x265_git.git" x265 && \
cd x265/build && \
rm -rf * && \
cmake ../source -DCMAKE_INSTALL_PREFIX="$LOCALDESTDIR" -DENABLE_SHARED:BOOLEAN=OFF -DCMAKE_CXX_FLAGS_RELEASE:STRING="-O3 -DNDEBUG" && \
make -j $(nproc | awk '{print $1 / 2}') && \
make install
RUN \
cd ${BUILD} && \
wget "https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2" && \
tar xfvj ffmpeg-snapshot.tar.bz2 && \
rm -rf ffmpeg-snapshot.tar.bz2 && \
cd ffmpeg && \
./configure --prefix="$LOCALDESTDIR" --enable-pthreads --extra-libs=-lpthread \
--disable-debug --disable-shared --disable-doc --enable-gpl --enable-version3 --pkg-config-flags=--static \
--enable-nonfree --enable-runtime-cpudetect --enable-fontconfig \
--enable-openssl --enable-libass --enable-libfdk-aac --enable-libfreetype \
--enable-libfribidi --enable-libmp3lame --enable-libopus --enable-libvpx --enable-librist \
--enable-libsrt --enable-libx264 --enable-libx265 --enable-libzmq --enable-libsvtav1 --enable-libdav1d && \
make -j $(nproc | awk '{print $1 / 2}') && \
make install
RUN \
cd / && \
cp /opt/ffmpeg/bin/ff* /usr/local/bin/ && \
rm -rf $BUILD $LOCALDESTDIR && \
dnf -y remove autoconf automake cmake diffutils file gcc ninja-build nasm gcc-c++ git libtool make perl yasm meson \
x264-devel zlib-devel expat-devel fontconfig-devel libxml2-devel lame-devel libpng-devel numactl-devel \
fribidi-devel zeromq-devel freetype-devel opus-devel libass-devel openssl-devel && \
dnf autoremove -y && \
dnf clean all
FROM base
ARG FFPLAYOUT_VERSION=0.22.0
ENV LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib
COPY --from=build /usr/local/ /usr/local/
ADD ./overide.conf /etc/systemd/system/ffplayout.service.d/overide.conf
RUN \
dnf update -y \
dnf install -y epel-release && \
dnf install -y 'dnf-command(config-manager)' && \
dnf config-manager --set-enabled crb && \
dnf install -y --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-$(rpm -E %rhel).noarch.rpm && \
dnf install -y --nogpgcheck https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-$(rpm -E %rhel).noarch.rpm && \
dnf install -y wget dejavu-sans-fonts sudo x264-libs fontconfig lame libpng numactl fribidi zeromq freetype opus libass && \
wget -q -O /tmp/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm "https://github.com/ffplayout/ffplayout/releases/download/v${FFPLAYOUT_VERSION}/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm" && \
dnf install -y /tmp/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm && \
dnf clean all && \
rm /tmp/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm && \
mkdir -p /home/ffpu && chown -R ffpu: /home/ffpu && \
systemctl enable ffplayout && \
ffplayout -u admin -p admin -m contact@example.com
EXPOSE 8787
CMD ["/usr/sbin/init"]

29
docker/nonfree.Dockerfile Normal file
View File

@ -0,0 +1,29 @@
FROM alpine:latest
ARG FFPLAYOUT_VERSION=0.24.0-alpha1
ARG SHARED_STORAGE=false
ENV DB=/db
ENV SHARED_STORAGE=${SHARED_STORAGE}
COPY --from=ffmpeg-build /usr/local/bin/ffmpeg /usr/local/bin/ffmpeg
COPY --from=ffmpeg-build /usr/local/bin/ffprobe /usr/local/bin/ffprobe
COPY README.md ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.* /tmp/
RUN apk update && \
apk upgrade && \
apk add --no-cache sqlite font-dejavu
RUN [[ -f "/tmp/ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.gz" ]] || \
wget -q "https://github.com/ffplayout/ffplayout/releases/download/v${FFPLAYOUT_VERSION}/ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.gz" -P /tmp/ && \
cd /tmp && \
tar xf "ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.gz" && \
cp ffplayout /usr/bin/ && \
rm -rf /tmp/* && \
mkdir ${DB}
RUN ffplayout -u admin -p admin -m contact@example.com --storage-path "/tv-media" --playlist-path "/playlists" --hls-path "/hls" --log-path "/logging"
EXPOSE 8787
CMD ["/usr/bin/ffplayout", "-l", "0.0.0.0:8787"]

View File

@ -1,112 +0,0 @@
FROM nvidia/cuda:12.0.1-cudnn8-runtime-centos7
ENV FFPLAYOUT_VERSION=0.22.0
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES compute,video,utility
ENV NVCODEC_VERSION 8.2.15.6
ENV FFMPEG_VERSION 5.1.2
ENV X264_VERSION=20191217-2245
ENV NASM_VERSION=2.14.02
ENV FDKAAC_VERSION=0.1.5
RUN yum install -y wget
RUN buildDeps="autoconf \
automake \
bzip2 \
cmake3 \
diffutils \
expat-devel \
file \
gcc \
gcc-c++ \
git \
gperf \
libtool \
make \
perl \
python3 \
openssl-devel \
tar \
yasm \
which \
zlib-devel" && \
echo "${SRC}/lib" > /etc/ld.so.conf.d/libc.conf && \
yum --enablerepo=extras install -y epel-release && \
yum --enablerepo=epel install -y ${buildDeps} && \
alternatives --install /usr/bin/cmake cmake /usr/bin/cmake3 0 && \
# Install the tools required to build nasm 2.14.02 \
nasmDeps="asciidoc \
perl-Font-TTF \
perl-Sort-Versions \
xmlto" && \
yum --enablerepo=epel install -y ${nasmDeps}
RUN curl -fsSLO https://www.nasm.us/pub/nasm/releasebuilds/$NASM_VERSION/nasm-$NASM_VERSION.tar.bz2 \
&& tar -xjf nasm-$NASM_VERSION.tar.bz2 \
&& cd nasm-$NASM_VERSION \
&& ./autogen.sh \
&& ./configure \
&& make -j$(nproc) \
&& make install
RUN \
DIR=/tmp/x264 && \
mkdir -p ${DIR} && \
cd ${DIR} && yum install -y wget && \
wget https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20191217-2245.tar.bz2 && \
tar -xjf x264-snapshot-${X264_VERSION}.tar.bz2 && cd x264-snapshot-${X264_VERSION} && \
./configure --enable-shared --enable-pic --disable-cli && \
make -j $(nproc | awk '{print $1 / 2}') && \
make install
### fdk-aac https://github.com/mstorsjo/fdk-aac
RUN \
DIR=/tmp/fdk-aac && \
mkdir -p ${DIR} && \
cd ${DIR} && \
curl -sL https://github.com/mstorsjo/fdk-aac/archive/v${FDKAAC_VERSION}.tar.gz | \
tar -zx --strip-components=1 && \
autoreconf -fiv && \
./configure --enable-shared --datadir="${DIR}" && \
make -j $(nproc | awk '{print $1 / 2}') && \
make install && \
rm -rf ${DIR}
RUN git clone --depth 1 https://git.videolan.org/git/ffmpeg/nv-codec-headers \
&& cd nv-codec-headers \
&& make install
ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig
RUN curl -fsSLO https://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2 \
&& tar -xjf ffmpeg-$FFMPEG_VERSION.tar.bz2 \
&& cd ffmpeg-$FFMPEG_VERSION \
&& ./configure --enable-nvenc --enable-libx264 --enable-gpl --enable-libfdk_aac --enable-nonfree --enable-postproc --enable-shared --enable-version3 \
&& make -j$(nproc) \
&& make install
RUN yum -y install systemd vim pico; yum clean all; \
(cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /etc/systemd/system/*.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*;
RUN yum -y install net-tools openssh-server
RUN echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
RUN yum update -y \
&& yum install -y dejavu-sans-fonts sudo wget \
&& wget -q -O /tmp/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm "https://github.com/ffplayout/ffplayout/releases/download/v${FFPLAYOUT_VERSION}/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm" \
&& yum install -y /tmp/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm \
&& yum clean all \
&& echo 'Docker!' | passwd --stdin root \
&& rm /tmp/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm \
&& mkdir -p /home/ffpu && chown -R ffpu: /home/ffpu \
&& systemctl enable ffplayout
EXPOSE 8787
RUN echo "/usr/local/lib" >> /etc/ld.so.conf.d/nvidia.conf
RUN echo "/usr/local/cuda/compat/" >> /etc/ld.so.conf.d/nvidia.conf
VOLUME [ "/tmp", "/run", "/run/lock", "/etc/ffplayout", "/usr/share/ffplayout" ,"/var/lib/ffplayout" ]
CMD ["/usr/sbin/init"]

215
docker/nvidia.Dockerfile Normal file
View File

@ -0,0 +1,215 @@
FROM nvidia/cuda:12.5.0-runtime-rockylinux9
ENV EXTRA_CFLAGS=-march=generic \
LOCALBUILDDIR=/tmp/build \
LOCALDESTDIR=/tmp/local \
PKG_CONFIG="pkg-config --static" \
PKG_CONFIG_PATH="/usr/lib64/pkgconfig/:/tmp/local/lib/pkgconfig" \
CPPFLAGS="-I/tmp/local/include -O3 -fno-strict-overflow -fstack-protector-all -fPIC" \
CFLAGS="-I/tmp/local/include -O3 -fno-strict-overflow -fstack-protector-all -fPIC" \
CXXFLAGS="-I/tmp/local/include -O2 -fPIC" \
LDFLAGS="-L/tmp/local/lib -pipe -Wl,-z,relro,-z,now -static" \
CC=clang
RUN dnf clean all -y && \
dnf makecache --refresh && \
dnf install -y epel-release && \
dnf config-manager --set-enabled crb
RUN dnf install -y which sqlite libstdc++-static libtool autoconf clang \
cmake ninja-build cargo ragel meson git pkgconfig bzip2 \
python3-devel gperf perl glibc-static binutils-devel \
nasm rsync
WORKDIR /tmp
RUN curl --retry 20 --retry-max-time 5 -L -k -f -w "%{response_code}" -o "zlib-1.3.1.tar.gz" "https://zlib.net/zlib-1.3.1.tar.gz" && \
tar xf "zlib-1.3.1.tar.gz" && \
cd "zlib-1.3.1" && \
./configure --prefix="$LOCALDESTDIR" --static && \
make -j $(nproc) && \
make install
RUN curl --retry 20 --retry-max-time 5 -L -k -f -w "%{response_code}" -o "openssl-1.1.1u.tar.gz" "https://www.openssl.org/source/openssl-1.1.1u.tar.gz" && \
tar xf "openssl-1.1.1u.tar.gz" && \
cd "openssl-1.1.1u" && \
./Configure --prefix=$LOCALDESTDIR --openssldir=$LOCALDESTDIR linux-x86_64 --libdir="$LOCALDESTDIR/lib" no-shared enable-camellia enable-idea enable-mdc2 enable-rfc3779 -static-libstdc++ -static-libgcc && \
make depend all && \
make install_sw
RUN curl --retry 20 --retry-max-time 5 -L -k -f -w "%{response_code}" -o "bzip2-1.0.8.tar.gz" "https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz" && \
tar xf "bzip2-1.0.8.tar.gz" && \
cd "bzip2-1.0.8" && \
make install PREFIX="$LOCALDESTDIR"
RUN curl --retry 20 --retry-max-time 5 -L -k -f -w "%{response_code}" -o "libpng-1.6.40.tar.gz" "http://prdownloads.sourceforge.net/libpng/libpng-1.6.40.tar.gz" && \
tar xf "libpng-1.6.40.tar.gz" && \
cd "libpng-1.6.40" && \
./configure --prefix="$LOCALDESTDIR" --disable-shared && \
make -j $(nproc) && \
make install
RUN git clone --depth 1 "https://github.com/fribidi/fribidi.git" && cd fribidi && \
./autogen.sh && \
./configure --prefix="$LOCALDESTDIR" --enable-shared=no && \
make -j $(nproc) 2>/dev/null || true && \
make install
RUN curl --retry 20 --retry-max-time 5 -L -k -f -w "%{response_code}" -o "expat-2.5.0.tar.bz2" "https://github.com/libexpat/libexpat/releases/download/R_2_5_0/expat-2.5.0.tar.bz2" && \
tar xf "expat-2.5.0.tar.bz2" && \
cd "expat-2.5.0" && \
./configure --prefix="$LOCALDESTDIR" --enable-shared=no --without-docbook && \
make -j $(nproc) && \
make install
RUN curl --retry 20 --retry-max-time 5 -L -k -f -w "%{response_code}" -o "freetype-2.13.1.tar.gz" "https://sourceforge.net/projects/freetype/files/freetype2/2.13.1/freetype-2.13.1.tar.gz" && \
tar xf "freetype-2.13.1.tar.gz" && \
cd "freetype-2.13.1" && \
./configure --prefix="$LOCALDESTDIR" --disable-shared --with-harfbuzz=no && \
make -j $(nproc) && \
make install
RUN curl --retry 20 --retry-max-time 5 -L -k -f -w "%{response_code}" -o "fontconfig-2.14.2.tar.gz" "https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.14.2.tar.gz" && \
tar xf "fontconfig-2.14.2.tar.gz" && \
cd "fontconfig-2.14.2" && \
./configure --prefix="$LOCALDESTDIR" --enable-shared=no && \
make -j $(nproc) && \
make install && \
cp fontconfig.pc "$LOCALDESTDIR/lib/pkgconfig/"
RUN git clone --depth 1 "https://github.com/harfbuzz/harfbuzz.git" && cd harfbuzz && \
mkdir build && cd build && \
meson setup -Denable_tools=false --default-library=static .. --prefix "$LOCALDESTDIR" --libdir="$LOCALDESTDIR/lib" && \
ninja && \
ninja install
RUN git clone --depth 1 "https://github.com/zeromq/libzmq.git" && cd libzmq && \
./autogen.sh && \
./configure --prefix="$LOCALDESTDIR" --enable-static --disable-shared && \
make -j $(nproc) && \
make install
RUN git clone --depth 1 "https://github.com/libass/libass.git" && cd libass && \
./autogen.sh && \
./configure --prefix="$LOCALDESTDIR" --enable-shared=no --disable-harfbuzz && \
make -j $(nproc) && \
make install
RUN git clone --depth 1 "https://github.com/mstorsjo/fdk-aac" && cd fdk-aac && \
./autogen.sh && \
./configure --prefix="$LOCALDESTDIR" --enable-shared=no && \
make -j $(nproc) && \
make install
RUN curl --retry 20 --retry-max-time 5 -L -k -f -w "%{response_code}" -o "lame-3.100.tar.gz" "https://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz" && \
tar xf "lame-3.100.tar.gz" && \
cd "lame-3.100" && \
./configure --prefix="$LOCALDESTDIR" --enable-expopt=full --enable-shared=no && \
make -j $(nproc) && \
make install
RUN curl --retry 20 --retry-max-time 5 -L -k -f -w "%{response_code}" -o "opus-1.4.tar.gz" "https://ftp.osuosl.org/pub/xiph/releases/opus/opus-1.4.tar.gz" && \
tar xf "opus-1.4.tar.gz" && \
cd "opus-1.4" && \
./configure --prefix="$LOCALDESTDIR" --enable-shared=no --enable-static --disable-doc && \
make -j $(nproc) && \
make install
RUN git clone --depth 1 "https://github.com/Haivision/srt.git" && cd srt && \
mkdir build && \
cd build && \
cmake .. -DCMAKE_INSTALL_PREFIX="$LOCALDESTDIR" -DENABLE_SHARED:BOOLEAN=OFF -DOPENSSL_USE_STATIC_LIBS=ON -DUSE_STATIC_LIBSTDCXX:BOOLEAN=ON -DENABLE_CXX11:BOOLEAN=ON -DCMAKE_INSTALL_BINDIR="bin" -DCMAKE_INSTALL_LIBDIR="lib" -DCMAKE_INSTALL_INCLUDEDIR="include" -DENABLE_APPS=0 -DENABLE_EXAMPLES=0 && \
make -j $(nproc) && \
make install
RUN git clone "https://github.com/webmproject/libvpx.git" && cd libvpx && \
./configure --prefix="$LOCALDESTDIR" --as=nasm --disable-shared --enable-static --disable-unit-tests --disable-docs --enable-postproc --enable-vp9-postproc --enable-runtime-cpu-detect && \
make -j $(nproc) && \
make install
RUN git clone "https://code.videolan.org/videolan/x264" && cd x264 && \
./configure --prefix="$LOCALDESTDIR" --enable-static && \
make -j $(nproc) && \
make install
RUN git clone "https://bitbucket.org/multicoreware/x265_git.git" && cd x265_git/build && \
cmake ../source -DCMAKE_INSTALL_PREFIX="$LOCALDESTDIR" -DENABLE_SHARED:BOOLEAN=OFF -DCMAKE_CXX_FLAGS_RELEASE:STRING="-O3 -DNDEBUG $CXXFLAGS" && \
make -j $(nproc) && \
make install
RUN git clone --depth 1 "https://gitlab.com/AOMediaCodec/SVT-AV1.git" && cd SVT-AV1/Build && \
cmake .. -G"Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$LOCALDESTDIR" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_BINDIR="bin" -DCMAKE_INSTALL_LIBDIR="lib" -DCMAKE_INSTALL_INCLUDEDIR="include" && \
make -j $(nproc) && \
make install
RUN git clone --depth 1 "https://code.videolan.org/videolan/dav1d.git" && cd dav1d && \
mkdir build && cd build && \
meson setup -Denable_tools=false -Denable_tests=false --default-library=static .. --prefix "$LOCALDESTDIR" --libdir="$LOCALDESTDIR/lib" && \
ninja && \
ninja install
RUN git clone --depth 1 https://git.videolan.org/git/ffmpeg/nv-codec-headers && cd nv-codec-headers && \
make install PREFIX="$LOCALDESTDIR"
RUN git clone --depth 1 https://git.ffmpeg.org/ffmpeg.git && cd ffmpeg && \
./configure \
--pkg-config-flags=--static \
--extra-cflags="-fopenmp -DZMG_STATIC" \
--extra-ldflags="-fopenmp -Wl,--copy-dt-needed-entries -Wl,--allow-multiple-definition" \
--enable-runtime-cpudetect \
--prefix=/usr/local \
--disable-debug \
--disable-doc \
--disable-ffplay \
--disable-shared \
--enable-gpl \
--enable-version3 \
--enable-nonfree \
--enable-small \
--enable-static \
--enable-libass \
--enable-fontconfig \
--enable-libfdk-aac \
--enable-libfribidi \
--enable-libfreetype \
--enable-libharfbuzz \
--enable-libmp3lame \
--enable-libopus \
--enable-libsrt \
--enable-libvpx \
--enable-libx264 \
--enable-libx265 \
--enable-libzmq \
--enable-nonfree \
--enable-openssl \
--enable-libsvtav1 \
--enable-libdav1d \
--enable-nvenc && \
make -j $(nproc) && \
make install
RUN strip /usr/local/bin/ffmpeg /usr/local/bin/ffprobe
WORKDIR /
ARG FFPLAYOUT_VERSION=0.24.0-alpha1
ARG SHARED_STORAGE=false
ENV DB=/db
ENV SHARED_STORAGE=${SHARED_STORAGE}
COPY README.md ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.* /tmp/
RUN [[ -f "/tmp/ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.gz" ]] || \
wget -q "https://github.com/ffplayout/ffplayout/releases/download/v${FFPLAYOUT_VERSION}/ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.gz" -P /tmp/ && \
cd /tmp && \
tar xf "ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.gz" && \
cp ffplayout /usr/bin/ && \
rm -rf /tmp/* && \
mkdir ${DB}
RUN ffplayout -u admin -p admin -m contact@example.com --storage-path "/tv-media" --playlist-path "/playlists" --hls-path "/hls" --log-path "/logging"
EXPOSE 8787
CMD ["/usr/bin/ffplayout", "-l", "0.0.0.0:8787"]