Merge pull request #104 from lukasklinger/master

Add Support for Docker
This commit is contained in:
Nick 2020-03-22 11:13:14 -04:00 committed by GitHub
commit f7f63207c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 96 additions and 0 deletions

35
Dockerfile Normal file
View File

@ -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"]

16
docker/docker-compose.yml Normal file
View File

@ -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:

7
docker/start.sh Normal file
View File

@ -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

View File

@ -69,3 +69,41 @@ Usage of .\MovieNight.exe:
-l string -l string
host:port of the MovieNight (default ":8089") 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*.