Dockerfile 920 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. RUN ls -l && pwd
  12. FROM alpine:latest
  13. LABEL name="kpt-tmr" \
  14. description="pt service" \
  15. owner="yiping.xu"
  16. WORKDIR /app/kpt-tmr
  17. RUN ls -l /usr/share && ls -l /usr/share/zoneinfo
  18. RUN apk add --no-cache tzdata \
  19. && ln -sv /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
  20. && echo "Asia/Shanghai" > /etc/timezone \
  21. && date
  22. COPY --from=0 /app/kpt-tmr/conf/ /app/kpt-tmr/bin/conf/
  23. COPY --from=0 /app/kpt-tmr/bin/kptTmr /app/kpt-tmr/bin/kptTmr
  24. EXPOSE 8081
  25. VOLUME ["/app/kpt-tmr/logger","/app/kpt-tmr/bin/conf/"]
  26. CMD ["/app/kpt-tmr/bin/kptTmr"]