From b4888d806959509873f052f7f97d925b2c6315e7 Mon Sep 17 00:00:00 2001 From: Lukas Date: Thu, 19 Mar 2020 11:49:42 +0100 Subject: [PATCH 1/3] added Dockerfile --- Dockerfile | 35 +++++++++++++++++++++++++++++++++++ docker/start.sh | 7 +++++++ 2 files changed, 42 insertions(+) create mode 100644 Dockerfile create mode 100644 docker/start.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8336c93 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,35 @@ +# +# ------ building mmovienight from source ------ +# + +FROM golang:1.13-alpine AS build + +WORKDIR /app + +RUN apk add alpine-sdk + +COPY . . + +RUN make + + + +# +# ------ creating image to run movienight ------ +# + +FROM alpine:latest + +WORKDIR /app + +VOLUME /config + +COPY --from=build /app /app +COPY --from=build /app/settings_example.json /config/settings.json + +RUN chmod +x /app/docker/start.sh + +EXPOSE 8089 +EXPOSE 1935 + +CMD ["/app/docker/start.sh"] \ No newline at end of file diff --git a/docker/start.sh b/docker/start.sh new file mode 100644 index 0000000..df4d191 --- /dev/null +++ b/docker/start.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +# copy current settings from config-volume to app folder +cp /config/settings.json /app/settings.json + +# start movienight +/app/MovieNight \ No newline at end of file From 895cb5d58c48a4a762c55227ab0a5204f02fa692 Mon Sep 17 00:00:00 2001 From: Lukas Date: Thu, 19 Mar 2020 12:55:17 +0100 Subject: [PATCH 2/3] added docker-compose file --- docker/docker-compose.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 docker/docker-compose.yml diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000..e6496e7 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,16 @@ +version: '2' + +services: + movienight: + image: movienight:latest + build: + context: ../ + dockerfile: Dockerfile + ports: + - 8089:8089 + - 1935:1935 + volumes: + - movienight-config:/config + +volumes: + movienight-config: \ No newline at end of file From c15bf0c9e5b91764edf2fa56359156da1ac2ed92 Mon Sep 17 00:00:00 2001 From: Lukas Date: Thu, 19 Mar 2020 13:34:51 +0100 Subject: [PATCH 3/3] updated README to include instructions for Docker --- readme.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/readme.md b/readme.md index 020426d..bec539b 100644 --- a/readme.md +++ b/readme.md @@ -60,3 +60,41 @@ Usage of .\MovieNight.exe: -l string host:port of the MovieNight (default ":8089") ``` + +## Docker +MovieNight provides a Dockerfile and a docker-compose file to run MovieNight using Docker. + +### Dockerfile +#### Building the Container +Install Docker, clone the repository and build: + +```shell +docker build -t movienight . +``` + +#### Running the Container +Run the image once it's built: + +```shell +docker run -d -p 8089:8089 -p 1935:1935 [-v ./settings.json:/config/settings.json] movienight +``` + +Explanation: +- **-d** runs the container in the background. +- **-p 8089:8089** maps the MovieNight web interface to port 8089 on the server. +- **-p 1935:1935** maps the RTMP port for OBS to port 1935 (default RTMP port) on the server. +- **-v ./settings.json:/config/settings.json** maps the file *settings.json* into the container. [OPTIONAL] + +### docker-compose +docker-compose will automatically build the image, no need to build it manually. + +Install Docker and docker-compose, clone the repository and change into the directory *./docker*. Then run: + +```shell +docker-compose up -d +``` + +This docker-compose file will create a volume called *movienight-config* and automatically add the standard *settings.json* file to it. It also maps port 8089 and 1935 to the same ports of the host. + +#### Notes for Running Using docker-compose +The container needs to be restarted to apply any changes you make to *settings.json*.