FROM golang:1.17-alpine as build WORKDIR /app/kpt-tmr-sheep 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/kptTmrSheep -ldflags "-X kpt.kptyun.cn:3000/kpt-event/kpt-tmr-sheep/pod.appVersion=tmr" main.go FROM alpine:latest LABEL name="kpt-tmr-sheep" \ description="pt service" \ owner="yiping.xu" WORKDIR /app/kpt-tmr-sheep 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-sheep/conf/ /app/kpt-tmr-sheep/bin/conf/ COPY --from=0 /app/kpt-tmr-sheep/uploads /app/kpt-tmr-sheep/bin/uploads COPY --from=0 /app/kpt-tmr-sheep/bin/kptTmr /app/kpt-tmr-sheep/bin/kptTmr EXPOSE 8081 VOLUME ["/app/kpt-tmr-sheep/logger","/app/kpt-tmr-sheep/bin/conf/"] CMD ["/app/kpt-tmr-sheep/bin/kptTmrSheep"]