From bd145fddf0f1ef73967fdefb04657643eccc36d0 Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Tue, 9 Jun 2020 18:28:07 -0700 Subject: [PATCH] Add Dockerfile for containeraization --- Dockerfile | 10 ++++++++++ README.md | 8 ++++++++ ffmpeg.go | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..387bd2c1c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM golang:alpine +EXPOSE 8080 1935 +RUN mkdir /app +ADD . /app +WORKDIR /app +RUN apk add --no-cache ffmpeg ffmpeg-libs +RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -o owncast . +RUN ls -al owncast +WORKDIR /app +CMD ["/app/owncast"] \ No newline at end of file diff --git a/README.md b/README.md index e30f5be33..40be713eb 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ * [Prerequisites](#prerequisites) * [Installation](#installation) * [Usage](#usage) + * [Docker](#docker) * [Usage with OBS](#usage-with-obs) * [Video storage and distribution options](#video-storage-options) * [Advanced usage](#advanced-usage) @@ -84,6 +85,13 @@ The goal is to have a single service that you can run and it works out of the bo 1. Open your web browser and visit http://yourserver:8080/. If you changed the port in the config file, then change the URL accordingly. If you are testing this on your own personal computer then you can visit http://localhost:8080. +### Docker + +If you want a simpler way to run an instance of owncast you can run it in a container with the supplied Dockerfile. + +1. Run `docker build -t owncast .` +1. Run `docker run -p 8080:8080 -p 1935:1935 -it owncast` + ## Usage with OBS 1. Install [OBS](https://obsproject.com/) and get it working with your local setup. diff --git a/ffmpeg.go b/ffmpeg.go index 1ea39064f..ed0c666c4 100644 --- a/ffmpeg.go +++ b/ffmpeg.go @@ -73,7 +73,7 @@ func startFfmpeg(configuration Config) { // fmt.Println(ffmpegCmd) - _, err := exec.Command("bash", "-c", ffmpegCmd).Output() + _, err := exec.Command("sh", "-c", ffmpegCmd).Output() fmt.Println(err) verifyError(err) }