FROM golang:alpine AS builder ARG MODULE_PATH 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 ./$MODULE_PATH FROM scratch AS final # Import the compiled executable from the first stage. COPY --from=builder /svc /svc CMD [ "/svc" ]