[docker] Utilize multistage building to minimize docker image

This commit is contained in:
Richard Huang 2020-05-30 14:12:59 -07:00
parent 02b71da7ec
commit d870a52cd1
No known key found for this signature in database
GPG key ID: FFDEF81D05C2EC94

View file

@ -1,4 +1,4 @@
FROM golang:alpine
FROM golang:alpine as build
LABEL maintainer="aeolyus"
WORKDIR /app
@ -6,9 +6,16 @@ COPY . .
RUN apk add --no-cache git gcc musl-dev
RUN go get -d -v ./...
RUN go install -v ./...
RUN go build -o gull
VOLUME /app/data
FROM alpine
WORKDIR /
COPY --from=build /app/public /public
COPY --from=build /app/gull .
VOLUME /data
EXPOSE 8081
CMD ["gull"]
CMD ["./gull"]