make docker image much smaller
Some checks reported errors
continuous-integration/drone/push Build was killed
Some checks reported errors
continuous-integration/drone/push Build was killed
This commit is contained in:
parent
1da5439358
commit
d63397b1ed
1
.dockerignore
Normal file
1
.dockerignore
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Dockerfile
|
42
Dockerfile
42
Dockerfile
|
@ -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
|
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 add --no-cache \
|
||||||
RUN apk upgrade
|
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
|
RUN wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz \
|
||||||
COPY config.yaml /root/.config/mumbledj/config.yaml
|
&& 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
|
COPY config.yaml /home/mumbledj/.config/mumbledj/config.yaml
|
||||||
RUN make install
|
|
||||||
RUN apk del go make build-base && rm -rf /var/cache/apk/*
|
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/local/bin/mumbledj"]
|
USER mumbledj
|
||||||
|
|
||||||
|
ENTRYPOINT ["/usr/bin/mumbledj"]
|
||||||
|
|
Reference in a new issue