Dockerfile 781 B

123456789101112131415161718192021222324252627282930
  1. FROM golang:1.17-alpine as build
  2. WORKDIR /app/kpt-tmr-group
  3. COPY . .
  4. RUN mkdir -p ./bin
  5. RUN go env -w GO111MODULE=on && \
  6. go env -w GOPROXY=https://goproxy.cn,direct && \
  7. go env -w CGO_ENABLED=0 && \
  8. go env -w GOARCH=amd64 && \
  9. go env -w GOOS=linux && \
  10. go build -o ./bin/kptTmrGroup -ldflags "-X kpt.kptyun.cn:3000/kpt-event/kpt-tmr-group/pod.appVersion=tmrGroup" main.go
  11. FROM alpine:latest
  12. LABEL name="kpt-tmr-group" \
  13. description="pt service" \
  14. owner="yiping.xu"
  15. WORKDIR /app/kpt-tmr-group
  16. COPY --from=0 /app/kpt-tmr-group/config/*.yaml /app/kpt-tmr-group/bin/config/
  17. COPY --from=0 /app/kpt-tmr-group/bin/kptTmrGroup /app/kpt-tmr-group/bin/kptTmrGroup
  18. EXPOSE 8090
  19. VOLUME /app/kpt-tmr-group/logger
  20. CMD ["/app/kpt-tmr-group/bin/kptTmrGroup","http"]