braice / MuMuDVB

A DVB IPTV streaming software
http://mumudvb.braice.net/
GNU General Public License v2.0
216 stars 133 forks source link

official Docker container(s) #197

Open alexanderadam opened 6 years ago

alexanderadam commented 6 years ago

First of all: thank you very much for MuMuDVB.

I just wanted to mention that it would be nice to have official Docker container on Docker hub.

braice commented 6 years ago

Hello Alexander

Thank you for the suggestion but I am new to Docker, can you tell me more how it works and what it does provides ?

Brice

2017-12-20 9:26 GMT-05:00 Alexander Adam notifications@github.com:

First of all: thank you very much for MuMuDVB.

I just wanted to mention that it would be nice to have official Docker container on Docker hub.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/braice/MuMuDVB/issues/197, or mute the thread https://github.com/notifications/unsubscribe-auth/AAUUD1TRjly6s3mBYQbB-ztBJiU3D4y3ks5tCRj8gaJpZM4RIdnF .

alexanderadam commented 6 years ago

Hey Brice,

thank you for your response. Although it's most probably too simple formulated: it's basically a very simple (especially regarding dependencies etc) distribution method that allows encapsulation of applications. It contains everything that is required to run the application and, if it's done well, allows reproducible builds. If persisted data is mounted outside of the container upgrading should not be a problem. And in case you want to remove the application: just remove the container and the data that is in the mounted containers. Nothing else will be touched. Nothing should harm your host system.

This usually requires a Dockerfile that contains the setup to build an image (i.e. install that, add this file, shell commands, …). With the help of the Dockerfile you can create an image which you can make accessible for everyone else (i.e. on Docker hub).

Everyone else can then just chose some parameters if required (i.e. mapping ports, folder mounts, etc) and run the container without having to build it first.

Maybe an example from a related project could help: You can find the container, documentation and Dockerfile of Tvheadend on Docker hub.

And you can simply pull the image with docker pull binhex/arch-tvheadend and run it with the mentioned options of the readme. You can see what it needs to build this containers is declared in it's Dockerfile (the used Linux distribution is usually not so relevant).

I'm not quite sure whether this answers your question but if it didn't: feel free to ask.

Saentist commented 6 years ago

Negatives ... Hudge footstep No support to easy build for beginner user. Need more resources.

maldex commented 6 years ago

Here's a sample i'm currently working on, also includes dvblast and some other tools i might need. Please note: the host will have to provide /dev/dvb to the container, docker will not solve any driver issues.

# try'n'error dockerfile (>=17.05) for mumudvb, dvblast and other headless TV applications
# mkdir my_dvb_toolbox; cd my_dvb_toolbox; vi Dockerfile

###
# Part 1: install compilers and devel-utils, download and build applications
###

# start from a fedora 28 image
FROM    fedora:28 AS compiler_build
RUN     echo "############################# COMPILER IMAGE #################################"

# include this very file into the image 
COPY    Dockerfile /Dockerfile

# install requirements
#RUN     dnf upgrade -y && dnf clean all
RUN     dnf install -y wget tar xz gzip git gcc gcc-c++ make libev libev-devel xz elfutils-libelf-devel mercurial perl-Proc-ProcessTable kernel-devel kernel-headers automake autoconf dh-autoreconf v4l-utils glibc-static libstdc++-static
#RUN     dnf install -y https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm 
#RUN     dnf install -y libdvbcsa-devel

# do not use pre-built dvb-apps from distro-mirror, but build from sources. This is required for MuMuDVB's CAM support on fedora.
RUN     cd /usr/local/src && \
        hg clone http://linuxtv.org/hg/dvb-apps && \
        cd dvb-apps && \
        # patching for >=4.14 Kernel (https://aur.archlinux.org/packages/linuxtv-dvb-apps)
        wget -q -O - https://git.busybox.net/buildroot/plain/package/dvb-apps/0003-handle-static-shared-only-build.patch | patch -p1 && \
        wget -q -O - https://git.busybox.net/buildroot/plain/package/dvb-apps/0005-utils-fix-build-with-kernel-headers-4.14.patch | patch -p1 && \
        wget -q -O - https://gitweb.gentoo.org/repo/gentoo.git/plain/media-tv/linuxtv-dvb-apps/files/linuxtv-dvb-apps-1.1.1.20100223-perl526.patch | patch -p1 && \
        make && make install && \ 
        ldconfig   # b/c libdvben50221.so

RUN     cd /usr/local/src && \
        git clone https://github.com/braice/MuMuDVB.git && \
        cd MuMuDVB && \
        autoreconf -i -f && \
        ./configure --enable-cam-support --enable-scam-support --enable-android && \
        make && make install 

RUN     cd /usr/local/src && \
        git clone git://git.videolan.org/bitstream.git && \
        cd bitstream && \
        make all && make install

RUN     cd /usr/local/src && \
        git clone https://code.videolan.org/videolan/dvblast.git && \
        cd dvblast && \
        make all && make install 

RUN     cd /usr/local/src && \
        wget http://wirbel.htpc-forum.de/w_scan/w_scan-20170107.tar.bz2 && \
        tar -jxf w_scan-20170107.tar.bz2 && \
        cd w_scan-20170107/ && \
        ./configure && make && make install

RUN     cd /usr/local/src && \
        git clone https://github.com/stefantalpalaru/w_scan2.git && \
        cd w_scan2 && \
        autoreconf -i -f && \
        ./configure && make && make install 

RUN     cd /usr/local/src && \
        wget http://udpxy.com/download/udpxy/udpxy-src.tar.gz && \
        tar -zxf udpxy-src.tar.gz && \
        cd udpxy-*/ && \
        make && make install 

RUN     cd /usr/local/src && \
        wget ftp://ftp.videolan.org/pub/videolan/miniSAPserver/0.3.8/minisapserver-0.3.8.tar.xz && \
        tar -Jxf minisapserver-0.3.8.tar.xz && \
        cd minisapserver-*/ && \
        ./configure && make && make install

###
# Part 2: install but not compile the applications. This leads to a much smaller image
###
FROM    fedora:28
RUN     echo "############################# RUNTIME IMAGE #################################"

# copy the whole /usr/local from the previous compiler-image (note the --from)
COPY    --from=compiler_build /usr/local /usr/local

# install runtime libraries
RUN     dnf install -y v4l-utils libev

# unfortunately, some make's need gcc anyway :(
RUN     dnf install -y make gcc gcc-c++ cpp glibc-devel glibc-headers kernel-headers 

RUN     cd /usr/local/src/dvb-apps && make install && ldconfig
RUN     cd /usr/local/src/MuMuDVB && make install
RUN     cd /usr/local/src/bitstream && make install
RUN     cd /usr/local/src/dvblast && make install
RUN     cd /usr/local/src/w_scan-20170107 && make install
RUN     cd /usr/local/src/w_scan2 && make install
RUN     cd /usr/local/src/udpxy-*/ && make install
RUN     cd /usr/local/src/minisapserver-*/ && make install

# remove gcc again
RUN     dnf remove -y make gcc gcc-c++ cpp glibc-devel glibc-headers kernel-headers 

# add a runtime user
RUN     useradd -c "simple user" -g users -G audio,video,cdrom,dialout,lp,tty,games user

# use this user as default user 
USER    user

# assume persistent storage 
VOLUME  /conf

# assume exposed ports
EXPOSE  8000:9000

# assume standard runtime executable
CMD     ["/bin/bash"]

###
# Part 3: build, verify and use this image
###
# build the container
# $ time docker build -t my_dvb_toolbox .

# explore the container. default bash is defined by CMD in dockerfile
# $ docker run -it --rm my_dvb_toolbox

# run a scan. note the mapped device tree /dev/dvb
# $ docker run -it --rm --device /dev/dvb/ my_dvb_toolbox w_scan -f s -s S13E0 -D1c

# run a mumudvb instance. Note the mapped device, filesystem and tcp-port
# $ docker run -it --rm --device /dev/dvb/ --volume ${PWD}/conf:/conf -p 8500:8500 my_dvb_toolbox mumudvb -d -c /conf/test.conf
maldex commented 6 years ago

Pushed to dockerhub. Note: this is not an 'official' build.

alexanderadam commented 6 years ago

@maldex awesome! Would it be possible for your to make a PR to integrate the used Dockerfile into the official Repository?

braice commented 6 years ago

Please go ahead with a pull request and I'll merge the Dockerfile !

2018-07-30 7:39 GMT-04:00 Alexander Adam notifications@github.com:

@maldex https://github.com/maldex awesome! Would it be possible for your to make a PR to integrate the used Dockerfile into the official Repository?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/braice/MuMuDVB/issues/197#issuecomment-408834688, or mute the thread https://github.com/notifications/unsubscribe-auth/AAUUDy8wxryqX5_LijlPM312D_xP5miNks5uLvCIgaJpZM4RIdnF .

maldex commented 6 years ago

For an official container, i would not like to include 3rd applications, but for personal use, a army-knife-type-container is great. Trying to figure a nice way for this.

maldex commented 6 years ago

created pull/228