make docker image much smaller
Some checks reported errors
continuous-integration/drone/push Build was killed

This commit is contained in:
Simon Bruder 2019-06-02 09:05:11 +00:00
parent 1da5439358
commit d63397b1ed
No known key found for this signature in database
GPG key ID: 6F03E0000CC5B62F
2 changed files with 32 additions and 11 deletions

1
.dockerignore Normal file
View file

@ -0,0 +1 @@
Dockerfile

View file

@ -1,19 +1,39 @@
FROM golang:alpine as builder
RUN apk add --no-cache \
build-base \
opus-dev
COPY . /go/src/github.com/matthieugrieger/mumbledj
WORKDIR /go/src/github.com/matthieugrieger/mumbledj
RUN go get -v \
&& go build -v -ldflags="-s -w"
FROM alpine
ENV GOPATH=/
RUN adduser -D mumbledj
RUN apk add --update ca-certificates go ffmpeg make build-base opus-dev python aria2
RUN apk upgrade
RUN apk add --no-cache \
aria2 \
libressl \
python2
RUN wget https://yt-dl.org/downloads/latest/youtube-dl -O /bin/youtube-dl && chmod a+x /bin/youtube-dl
RUN wget -O /usr/bin/youtube-dl https://yt-dl.org/downloads/latest/youtube-dl \
&& chmod +x /usr/bin/youtube-dl
COPY . /src/github.com/matthieugrieger/mumbledj
COPY config.yaml /root/.config/mumbledj/config.yaml
RUN wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz \
&& tar xvf ffmpeg-git-amd64-static.tar.xz '*/ffmpeg' || true \
&& mv ffmpeg-git-20190527-amd64-static/ffmpeg /usr/bin/ffmpeg \
&& rm -rf ffmpeg-git-* \
&& apk add --no-cache upx \
&& upx /usr/bin/ffmpeg \
&& apk del upx
WORKDIR /src/github.com/matthieugrieger/mumbledj
COPY --from=builder /go/src/github.com/matthieugrieger/mumbledj/mumbledj /usr/bin/mumbledj
RUN make
RUN make install
RUN apk del go make build-base && rm -rf /var/cache/apk/*
COPY config.yaml /home/mumbledj/.config/mumbledj/config.yaml
ENTRYPOINT ["/usr/local/bin/mumbledj"]
USER mumbledj
ENTRYPOINT ["/usr/bin/mumbledj"]