[docker] Utilize multistage building to minimize docker image
This commit is contained in:
parent
02b71da7ec
commit
d870a52cd1
1 changed files with 11 additions and 4 deletions
15
Dockerfile
15
Dockerfile
|
@ -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"]
|
||||
|
|
Loading…
Reference in a new issue