Dockerfile 509 B

12345678910111213141516171819
  1. FROM golang:latest as build-env
  2. RUN mkdir /app
  3. WORKDIR /app
  4. COPY go.mod .
  5. COPY go.sum .
  6. # Get dependancies - will also be cached if we won't change mod/sum
  7. RUN go mod download
  8. # COPY the source code as the last step
  9. COPY . .
  10. # Build the binary
  11. RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -o /go/bin/app
  12. FROM scratch
  13. COPY --from=build-env /go/bin/app /go/bin/app
  14. ADD ./cloud/default.json /models/default.json
  15. ADD ./cloud/azure.json /models/azure.json
  16. ENTRYPOINT ["/go/bin/app"]