diff --git a/docker/Dockerfile b/docker/Dockerfile index 96e9d4a2..1d0042c5 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,42 +1,27 @@ -FROM almalinux:9 AS base +FROM alpine:latest -ENV container docker +ARG FFPLAYOUT_VERSION=0.24.0-alpha1 +ARG SHARED_STORAGE=false -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/* +ENV DB=/db +ENV SHARED_STORAGE=${SHARED_STORAGE} -FROM base +COPY README.md ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.* /tmp/ -ARG FFPLAYOUT_VERSION=0.22.0 -COPY README.md *.rpm /tmp/ +RUN apk update && \ + apk upgrade && \ + apk add --no-cache ffmpeg sqlite font-dejavu -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 ffmpeg wget dejavu-sans-fonts sudo && \ - dnf clean all +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 [[ -f /tmp/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm ]] || wget -q "https://github.com/ffplayout/ffplayout/releases/download/v${FFPLAYOUT_VERSION}/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm" -P /tmp/ && \ - dnf install -y /tmp/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm && \ - rm /tmp/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm && \ - sed -i "s/User=ffpu/User=root/g" /usr/lib/systemd/system/ffplayout.service && \ - systemctl enable ffplayout && \ - ffplayout -u admin -p admin -m contact@example.com +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 -# Maybe on some systems is needed, combined with run parameters: --tmpfs /tmp --tmpfs /run --tmpfs /run/lock -# More infos: https://serverfault.com/a/1087467/387878 -#VOLUME [ "/tmp", "/run", "/run/lock" ] - -CMD ["/usr/sbin/init"] +CMD ["/usr/bin/ffplayout", "-l", "0.0.0.0:8787"] diff --git a/docker/README.md b/docker/README.md index cdb45f8e..1b0005c2 100644 --- a/docker/README.md +++ b/docker/README.md @@ -40,8 +40,11 @@ How to build the image:\ # build default docker build -t ffplayout-image . +# build with shared storage (same storage for all channels) +docker build --build-arg SHARED_STORAGE=true . + # build from root folder, to copy local *.rpm package -docker build -f docker/Dockerfile -t ffplayout-image:alma . +docker build -f docker/Dockerfile -t ffplayout-image . # build ffmpeg from source docker build -f fromSource.Dockerfile -t ffplayout-image:from-source . @@ -53,10 +56,10 @@ docker build -f nvidia-centos7.Dockerfile -t ffplayout-image:nvidia . example of command to start the container: ```BASH -docker run -it --name ffplayout --privileged -p 8787:8787 ffplayout-image +docker run -it -v /path/to/db:/db -v /path/to/storage:/tv-media -v /path/to/playlists:/playlists -v /path/to/hls:/hls -v /path/to/logging:/logging --name ffplayout -p 8787:8787 ffplayout-image # run in daemon mode -docker run -d --name ffplayout --privileged -p 8787:8787 ffplayout-image +docker run -d --name ffplayout -p 8787:8787 ffplayout-image # run with docker-compose docker-compose up -d diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 608b4c15..296ce389 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -2,10 +2,7 @@ version: '3' services: ffplayout: - cap_add: - - SYS_ADMIN container_name: ffplayout - privileged: true build: context: . dockerfile: ./Dockerfile