Dockerfile 700 B

1234567891011121314151617181920212223242526
  1. FROM golang:latest as build-env
  2. RUN mkdir /app
  3. WORKDIR /app
  4. COPY go.mod .
  5. COPY go.sum .
  6. # Get dependencies - 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 set -e ;\
  12. cd cmd/costmodel;\
  13. CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
  14. go build -a -installsuffix cgo -o /go/bin/app
  15. FROM alpine:3.10.2
  16. RUN apk add --update --no-cache ca-certificates
  17. COPY --from=build-env /go/bin/app /go/bin/app
  18. ADD ./configs/default.json /models/default.json
  19. ADD ./configs/azure.json /models/azure.json
  20. ADD ./configs/aws.json /models/aws.json
  21. ADD ./configs/gcp.json /models/gcp.json
  22. USER 1001
  23. ENTRYPOINT ["/go/bin/app"]