diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..57465a0b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,36 @@ +FROM debian:buster + +# Download Raspberry firmware and unpack /opt/vc folder +ADD https://github.com/raspberrypi/firmware/archive/1.20200902.tar.gz /tmp/rpiplay/firmware.tar.gz + +RUN cd /tmp/rpiplay && \ + tar -xzvf firmware.tar.gz && \ + cp -R ./firmware-1.20200902/opt/vc /opt/vc && \ + rm -rf ./firmware-1.20200902 + +# Add sources +ADD . /tmp/rpiplay/RPiPlay-master + +# Install essential dependencies +RUN cd /tmp/rpiplay && \ + apt-get update && \ + apt-get -y install cmake build-essential libavahi-compat-libdnssd-dev libplist-dev libssl-dev avahi-discover libnss-mdns + +# Build RPiPlay +RUN cd /tmp/rpiplay/RPiPlay-master && \ + mkdir build && \ + cd build && \ + cmake .. && \ + make + +WORKDIR /tmp/rpiplay/RPiPlay-master/build + +# MISC settings +COPY ./avahi-daemon.conf /etc/avahi/avahi-daemon.conf + +USER root +RUN mkdir -p /var/run/dbus + +# Run container +EXPOSE 5353 51826 +ENTRYPOINT ["/tmp/rpiplay/RPiPlay-master/build/rpiplay"] diff --git a/README.md b/README.md index 421d6e96..5363a9e4 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,34 @@ At the moment, these options are implemented: **-v/-h**: Displays short help and version information. +# Docker + +RPiPlay can be used in a docker environment + +You can build an image from sources it using following command: +``` +docker build . -t rpiplay:dev +``` + +Example docker-compose yaml for running it + +``` +--- +version: "2.1" +services: + rpiplay: + container_name: rpiplay + image: rpiplay:dev + restart: always + network_mode: host + command: -n "test" -a off + volumes: + - /opt/vc:/opt/vc + - /var/run/dbus:/var/run/dbus + - /var/run/avahi-daemon/socket:/var/run/avahi-daemon/socket + devices: + - /dev/vchiq +``` # Disclaimer diff --git a/avahi-daemon.conf b/avahi-daemon.conf new file mode 100644 index 00000000..812443ee --- /dev/null +++ b/avahi-daemon.conf @@ -0,0 +1,71 @@ +# This file is part of avahi. +# +# avahi is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# avahi is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +# License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with avahi; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. + +# See avahi-daemon.conf(5) for more information on this configuration +# file! + +# https://linux.die.net/man/5/avahi-daemon.conf +# https://raw.githubusercontent.com/lathiat/avahi/master/avahi-daemon/avahi-daemon.conf + +[server] +#host-name=foo +#domain-name=local +#browse-domains=0pointer.de, zeroconf.org +use-ipv4=yes +use-ipv6=no +#allow-interfaces=eth0 +#deny-interfaces=eth1 +#check-response-ttl=no +#use-iff-running=no +#enable-dbus=yes +#disallow-other-stacks=no +#allow-point-to-point=no +#cache-entries-max=4096 +#clients-max=4096 +#objects-per-client-max=1024 +#entries-per-entry-group-max=32 +ratelimit-interval-usec=1000000 +ratelimit-burst=1000 + +[wide-area] +enable-wide-area=yes + +[publish] +#disable-publishing=no +#disable-user-service-publishing=no +#add-service-cookie=no +#publish-addresses=yes +#publish-hinfo=no +#publish-workstation=no +#publish-domain=yes +#publish-dns-servers=192.168.50.1, 192.168.50.2 +#publish-resolv-conf-dns-servers=yes +#publish-aaaa-on-ipv4=yes +#publish-a-on-ipv6=no + +[reflector] +#enable-reflector=no +#reflect-ipv=no + +[rlimits] +#rlimit-as= +#rlimit-core=0 +#rlimit-data=8388608 +#rlimit-fsize=0 +#rlimit-nofile=768 +#rlimit-stack=8388608 +#rlimit-nproc=3