Dockerfile 1023 B

1234567891011121314151617181920212223
  1. # This Dockerfile builds an image for a client_golang example.
  2. #
  3. # Use as (from the root for the client_golang repository):
  4. # docker build -f examples/$name/Dockerfile -t prometheus/golang-example-$name .
  5. # Builder image, where we build the example.
  6. FROM golang:1 AS builder
  7. WORKDIR /go/src/github.com/prometheus/client_golang
  8. COPY . .
  9. WORKDIR /go/src/github.com/prometheus/client_golang/prometheus
  10. RUN go get -d
  11. WORKDIR /go/src/github.com/prometheus/client_golang/examples/random
  12. RUN CGO_ENABLED=0 GOOS=linux go build -a -tags netgo -ldflags '-w'
  13. WORKDIR /go/src/github.com/prometheus/client_golang/examples/simple
  14. RUN CGO_ENABLED=0 GOOS=linux go build -a -tags netgo -ldflags '-w'
  15. # Final image.
  16. FROM prom/busybox
  17. LABEL maintainer="The Prometheus Authors <prometheus-developers@googlegroups.com>"
  18. COPY --from=builder /go/src/github.com/prometheus/client_golang/examples/random \
  19. /go/src/github.com/prometheus/client_golang/examples/simple ./
  20. EXPOSE 8080
  21. CMD echo Please run an example. Either /random or /simple