Dockerfile 845 B

12345678910111213141516171819202122232425262728293031323334
  1. FROM golang:1.17-alpine as build
  2. WORKDIR /app/kpt-tmr
  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/kptTmr -ldflags "-X kpt.kptyun.cn:3000/kpt-event/kpt-tmr/pod.appVersion=tmr" main.go
  11. FROM alpine:latest
  12. LABEL name="kpt-tmr" \
  13. description="pt service" \
  14. owner="yiping.xu"
  15. WORKDIR /app/kpt-tmr
  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/conf/ /app/kpt-tmr/bin/conf/
  20. COPY --from=0 /app/kpt-tmr/bin/kptTmr /app/kpt-tmr/bin/kptTmr
  21. EXPOSE 8081
  22. VOLUME ["/app/kpt-tmr/logger","/app/kpt-tmr/bin/conf/"]
  23. CMD ["/app/kpt-tmr/bin/kptTmr"]