Dockerfile 695 B

123456789101112131415161718192021222324252627282930
  1. FROM golang:alpine AS builder
  2. LABEL stage=gobuilder
  3. ENV CGO_ENABLED 0
  4. ENV GOPROXY https://goproxy.cn,direct
  5. RUN apk update --no-cache && apk add --no-cache tzdata
  6. WORKDIR /build
  7. ADD go.mod .
  8. ADD go.sum .
  9. RUN go mod download
  10. COPY . .
  11. COPY flowsrv/rpc/etc /app/etc
  12. RUN go build -ldflags="-s -w" -o /app/flowsrv flowsrv/rpc/flowsrv.go
  13. FROM scratch
  14. COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
  15. COPY --from=builder /usr/share/zoneinfo/Asia/Shanghai /usr/share/zoneinfo/Asia/Shanghai
  16. ENV TZ Asia/Shanghai
  17. WORKDIR /app
  18. COPY --from=builder /app/flowsrv /app/flowsrv
  19. COPY --from=builder /app/etc /app/etc
  20. CMD ["./flowsrv", "-f", "etc/flowsrv.yaml"]