Dockerfile 448 B

1234567891011121314151617181920212223242526
  1. FROM golang:alpine AS builder
  2. LABEL stage=gobuilder
  3. ENV CGO_ENABLED 0
  4. ENV GOOS linux
  5. ENV GOPROXY https://goproxy.cn,direct
  6. WORKDIR $GOPATH/src/zero
  7. COPY . .
  8. RUN go build -ldflags="-s -w" -o /app/main example/load/simulate/cpu/main.go
  9. FROM alpine
  10. RUN apk add --no-cache tzdata
  11. ENV TZ Asia/Shanghai
  12. RUN apk add git
  13. RUN go get github.com/vikyd/go-cpu-load
  14. RUN mkdir /app
  15. COPY --from=builder /app/main /app/main
  16. WORKDIR /app
  17. CMD ["/app/main"]