20 lines
No EOL
339 B
Docker
20 lines
No EOL
339 B
Docker
FROM golang:alpine AS builder
|
|
|
|
ENV GOPROXY https://modules.fromouter.space
|
|
ENV GO111MODULE=on
|
|
|
|
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" ] |