Dockerfile 668 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 bff/cmdbff/api/etc /app/etc
  12. RUN go build -ldflags="-s -w" -o /app/cmdbff bff/cmdbff/api/cmdbff.go
  13. FROM alpine
  14. RUN apk update --no-cache && apk add --no-cache ca-certificates
  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/cmdbff /app/cmdbff
  19. COPY --from=builder /app/etc /app/etc
  20. CMD ["./cmdbff", "-f", "etc/cmdbff.yaml"]