2019-08-22 12:48:33 +00:00
|
|
|
FROM golang:alpine AS builder
|
2019-08-22 12:19:17 +00:00
|
|
|
|
|
|
|
ENV GOPROXY https://modules.fromouter.space
|
2019-08-22 12:48:33 +00:00
|
|
|
ENV GO111MODULE=on
|
2019-08-22 12:19:17 +00:00
|
|
|
|
2019-08-22 12:48:33 +00:00
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
# Get updated modules
|
|
|
|
COPY ./ ./
|
|
|
|
RUN go mod download
|
|
|
|
|
|
|
|
# Compile code
|
|
|
|
RUN CGO_ENABLED=0 go build -o /svc .
|
|
|
|
|
|
|
|
FROM scratch AS final
|
|
|
|
|
|
|
|
# Import the compiled executable from the first stage.
|
|
|
|
COPY --from=builder /svc /svc
|
|
|
|
|
|
|
|
CMD [ "/svc" ]
|