From 1b89548f64b1d9b915cf38dc74bf527e02476290 Mon Sep 17 00:00:00 2001 From: Blallo Date: Thu, 22 Oct 2020 20:29:32 +0200 Subject: [PATCH] Fix docker stuff --- broadcast/.dockerignore | 3 +++ broadcast/Dockerfile | 21 ++++++----------- broadcast/entrypoint.sh | 6 +++++ docker-compose.prod.yml | 7 ++++++ docker-compose.yml | 52 ++++++++++++++++++++--------------------- entrypoint.sh | 4 ---- 6 files changed, 49 insertions(+), 44 deletions(-) create mode 100644 broadcast/.dockerignore create mode 100755 broadcast/entrypoint.sh create mode 100644 docker-compose.prod.yml delete mode 100755 entrypoint.sh diff --git a/broadcast/.dockerignore b/broadcast/.dockerignore new file mode 100644 index 0000000..4734f7b --- /dev/null +++ b/broadcast/.dockerignore @@ -0,0 +1,3 @@ +/external +Makefile +*.md diff --git a/broadcast/Dockerfile b/broadcast/Dockerfile index bb9cb60..e1d96b0 100644 --- a/broadcast/Dockerfile +++ b/broadcast/Dockerfile @@ -1,24 +1,17 @@ -FROM golang:1.15 AS builder +FROM golang:1.15 ENV DEBIAN_FRONTEND=noninteractive -COPY ./go.* /broadcast/ -COPY /*.go /broadcast/ +COPY . /broadcast/ WORKDIR /broadcast RUN apt-get update \ - && apt-get install -y libmp3lame-dev\ - && go get -u ./... \ + && apt-get install -y libmp3lame-dev procps \ + && env go build -o /broadcast/broadcast \ + && cp /broadcast/broadcast /srv/ \ + && cp /broadcast/entrypoint.sh /srv/ \ && rm -rf /var/lib/apt/lists/* -# RUN env GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o /broadcast/broadcast -RUN env go build -o /broadcast/broadcast -# RUN go build -o /broadcast/broadcast - -# FROM alpine:latest -FROM golang:1.15 - WORKDIR /srv -COPY --from=builder /broadcast/broadcast /srv/broadcast -CMD /srv/broadcast +ENTRYPOINT ["/srv/entrypoint.sh"] diff --git a/broadcast/entrypoint.sh b/broadcast/entrypoint.sh new file mode 100755 index 0000000..2254d26 --- /dev/null +++ b/broadcast/entrypoint.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +trap "exit 0" 1 2 3 15 + +sleep 5 +/srv/broadcast ${@} & wait diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml new file mode 100644 index 0000000..8c89d51 --- /dev/null +++ b/docker-compose.prod.yml @@ -0,0 +1,7 @@ +version: "3" + +services: + broadcast: + depends_on: [] + environment: + - MUMBLE_SERVER: parla.abbiamoundominio.org:64738 diff --git a/docker-compose.yml b/docker-compose.yml index c2f7df4..b5eb443 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,32 +3,32 @@ version: "3" services: broadcast: image: unit/broadcast - build: . - # depends_on: - # - mumble + build: broadcast/ + depends_on: + - mumble environment: - - MUMBLE_SERVER: parla.abbiamoundominio.org:64738 + MUMBLE_SERVER: mumble:64738 - # icecast: - # image: infiniteproject/icecast - # ports: - # - "8000:80" - # healthcheck: - # test: ["CMD", "curl", "-f", "http://localhost:8000"] - # interval: 30s - # timeout: 1s - # retries: 3 - # start_period: 4s + icecast: + image: infiniteproject/icecast + ports: + - "8000:80" + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8000"] + interval: 30s + timeout: 1s + retries: 3 + start_period: 4s - # mumble: - # image: coppit/mumble-server - # ports: - # - "64738:64738" - # volumes: - # - $PWD/mumble:/data - # healthcheck: - # test: ["CMD", "curl", "-f", "http://localhost:64738"] - # interval: 30s - # timeout: 1s - # retries: 3 - # start_period: 4s + mumble: + image: coppit/mumble-server + ports: + - "64738:64738" + volumes: + - $PWD/mumble:/data + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:64738"] + interval: 30s + timeout: 1s + retries: 3 + start_period: 4s diff --git a/entrypoint.sh b/entrypoint.sh deleted file mode 100755 index 34f2e81..0000000 --- a/entrypoint.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -sleep 5 -/srv/broadcast ${@} -- 2.30.2