Dockerfile 654 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 core/auth/rpc/etc /app/etc
  12. RUN go build -ldflags="-s -w" -o /app/auth core/auth/rpc/auth.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/auth /app/auth
  19. COPY --from=builder /app/etc /app/etc
  20. CMD ["./auth", "-f", "etc/auth.yaml"]