docker: Multistage Docker build (#6)

Reducing image size approximately from 341MB to 16MB
This commit is contained in:
Aleksey Lobanov 2020-12-06 13:54:16 +03:00 committed by GitHub
parent ead67c221f
commit 10645aa3a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,4 @@
FROM golang:alpine
FROM golang:alpine AS builder
EXPOSE 8000/tcp
@ -17,3 +17,13 @@ RUN go get -v -d
RUN go get github.com/GeertJohan/go.rice/rice
RUN GOROOT=/go rice embed-go
RUN go install -v
FROM alpine
EXPOSE 8000/tcp
ENTRYPOINT ["pastebin"]
COPY --from=builder /go/bin/pastebin /bin/pastebin