Dockerfile 994 B

1234567891011121314151617181920212223242526272829303132333435
  1. FROM golang:1.17-alpine as build
  2. WORKDIR /app/kpt-tmr-sheep
  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/kptTmrSheep -ldflags "-X kpt.kptyun.cn:3000/kpt-event/kpt-tmr-sheep/pod.appVersion=tmr" main.go
  11. FROM alpine:latest
  12. LABEL name="kpt-tmr-sheep" \
  13. description="pt service" \
  14. owner="yiping.xu"
  15. WORKDIR /app/kpt-tmr-sheep
  16. RUN apk update && apk add tzdata
  17. RUN ln -sv /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
  18. && echo "Asia/Shanghai" > /etc/timezone \
  19. COPY --from=0 /app/kpt-tmr-sheep/conf/ /app/kpt-tmr-sheep/bin/conf/
  20. COPY --from=0 /app/kpt-tmr-sheep/uploads /app/kpt-tmr-sheep/bin/uploads
  21. COPY --from=0 /app/kpt-tmr-sheep/bin/kptTmr /app/kpt-tmr-sheep/bin/kptTmr
  22. EXPOSE 8081
  23. VOLUME ["/app/kpt-tmr-sheep/logger","/app/kpt-tmr-sheep/bin/conf/"]
  24. CMD ["/app/kpt-tmr-sheep/bin/kptTmrSheep"]