FROM golang:1.17-alpine as build WORKDIR /app/kpt-tmr COPY . . RUN mkdir -p ./bin RUN go env -w GO111MODULE=on && \ go env -w GOPROXY=https://goproxy.cn,direct && \ go env -w CGO_ENABLED=0 && \ go env -w GOARCH=amd64 && \ go env -w GOOS=linux && \ go build -o ./bin/kptTmr -ldflags "-X kpt.kptyun.cn:3000/kpt-event/kpt-tmr/pod.appVersion=tmr" main.go FROM alpine:latest LABEL name="kpt-tmr" \ description="pt service" \ owner="yiping.xu" WORKDIR /app/kpt-tmr RUN apk update && apk add tzdata RUN ln -sv /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ && echo "Asia/Shanghai" > /etc/timezone \ COPY --from=0 /app/kpt-tmr/conf/ /app/kpt-tmr/bin/conf/ COPY --from=0 /app/kpt-tmr/bin/kptTmr /app/kpt-tmr/bin/kptTmr EXPOSE 8081 VOLUME ["/app/kpt-tmr/logger","/app/kpt-tmr/bin/conf/"] CMD ["/app/kpt-tmr/bin/kptTmr"]