From 05e995b11b52ff56a62fb6af1eae97683f76974b Mon Sep 17 00:00:00 2001 From: pataquets Date: Sat, 1 Aug 2020 21:07:56 +0200 Subject: [PATCH] Dockerfile: make image build from local source code instead of copying outside build. --- Dockerfile | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 56d309c..9bf50c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,20 @@ FROM alpine:latest as certs RUN apk --update add ca-certificates +FROM golang:alpine as build +WORKDIR /app/ + +COPY go.mod . +COPY go.sum . +RUN go mod download + +COPY . . +RUN go build -v + FROM scratch COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt +COPY --from=build /app/webdav /webdav EXPOSE 80 -COPY webdav /webdav - ENTRYPOINT [ "/webdav" ]