From 4d1763d5fd14db1260e3a119798e1d101389f503 Mon Sep 17 00:00:00 2001 From: pataquets Date: Mon, 16 Nov 2020 18:45:45 +0000 Subject: [PATCH 1/3] Dockerfile initial version. --- Dockerfile | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3d9feb4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM golang + +RUN \ + apt update && \ + DEBIAN_FRONTEND=noninteractive \ + apt-get install -y --no-install-recommends \ + libmpv-dev \ + python-pip \ + && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +RUN \ + pip install --no-cache youtube-dl \ + && youtube-dl --version + +WORKDIR ${GOPATH}/src/github.com/aykevl/plaincast/ +COPY . ${GOPATH}/src/github.com/aykevl/plaincast/ + +RUN go get -v . +RUN go install -i . + +ENTRYPOINT [ "plaincast" ] From be03f1665c1efdd95f52639d16de910b5b0fb82a Mon Sep 17 00:00:00 2001 From: pataquets Date: Mon, 16 Nov 2020 20:56:36 +0100 Subject: [PATCH 2/3] Add Docker Compose manifest. --- docker-compose.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..25d88dc --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +version: "2.4" +services: + plaincast: + container_name: plaincast + restart: unless-stopped + build: . + environment: + - ALSA_CARD + network_mode: host + devices: + - /dev/snd + + From 883dadd9d5a8ffd4b94ef363ba207510ab6ae36b Mon Sep 17 00:00:00 2001 From: pataquets Date: Mon, 16 Nov 2020 21:08:30 +0100 Subject: [PATCH 3/3] Docker: document usage. --- README.md | 14 +++++++++++++- docker-compose.yml | 2 -- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index db9c78d..f4a46cd 100644 --- a/README.md +++ b/README.md @@ -77,8 +77,20 @@ Or for Python 3: $ sudo pip3 install --upgrade youtube-dl It is advisable to run this regularly as it has to keep up with YouTube updates. -Certainly first try updating youtube-dl when plaincast stops working. +Certainly first try updating `youtube-dl` when plaincast stops working. +## Docker + +Both `Dockerfile` and Docker Compose manifest are provided. The former builds +a Docker image with the program binary built from local code and the required +build dependencies. The Docker image also includes a recent `youtube-dl` +version. This will avoid the need of installing a recent version for the local +OS and version on the host, thus avoiding the risks of installing any software. +The [Docker Compose manifest](./docker-compose.yml) contains the configuration +settings needed to launch a Docker container. +To run the Docker image, just run: + + $ docker-compose up --build --force-recreate ## Known issues diff --git a/docker-compose.yml b/docker-compose.yml index 25d88dc..15b9b69 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,5 +9,3 @@ services: network_mode: host devices: - /dev/snd - -