Dockerfile 725 B

12345678910111213141516171819202122232425262728293031
  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. COPY --from=0 /app/kpt-tmr/conf/ /app/kpt-tmr/bin/conf/
  18. COPY --from=0 /app/kpt-tmr/bin/kptTmr /app/kpt-tmr/bin/kptTmr
  19. EXPOSE 8081
  20. VOLUME ["/app/kpt-tmr/logger","/app/kpt-tmr/bin/conf/"]
  21. CMD ["/app/kpt-tmr/bin/kptTmr"]