Dockerfile 807 B

123456789101112131415161718192021222324252627282930
  1. FROM golang:1.19-alpine as build
  2. WORKDIR /app/kpt-pasture
  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/kptTmrGroup -ldflags "-X kpt.kptyun.cn:3000/kpt-event/kpt-pasture/pod.appVersion=beef" main.go
  11. FROM alpine:latest
  12. LABEL name="kpt-pasture" \
  13. description="pt service" \
  14. owner="yiping.xu"
  15. WORKDIR /app/kpt-pasture
  16. COPY --from=0 /app/kpt-pasture/config/ /app/kpt-pasture/bin/config/
  17. COPY --from=0 /app/kpt-pasture/bin/kptPasture /app/kpt-pasture/bin/kptPasture
  18. EXPOSE 8090
  19. VOLUME ["/app/kpt-pasture/logger","/app/kpt-pasture/bin/config","/app/kpt-pasture/files"]
  20. CMD ["/app/kpt-pasture/bin/kptPasture","http"]