2017-09-19 15:41:00 +03:00
|
|
|
# This Dockerfile builds an image for a client_golang example.
|
|
|
|
#
|
|
|
|
# Use as (from the root for the client_golang repository):
|
|
|
|
# docker build -f examples/$name/Dockerfile -t prometheus/golang-example-$name .
|
|
|
|
|
|
|
|
# Builder image, where we build the example.
|
2018-07-09 21:09:06 +03:00
|
|
|
FROM golang:1 AS builder
|
2017-09-19 15:41:00 +03:00
|
|
|
WORKDIR /go/src/github.com/prometheus/client_golang
|
|
|
|
COPY . .
|
|
|
|
WORKDIR /go/src/github.com/prometheus/client_golang/prometheus
|
|
|
|
RUN go get -d
|
|
|
|
WORKDIR /go/src/github.com/prometheus/client_golang/examples/random
|
|
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -tags netgo -ldflags '-w'
|
2018-07-09 21:09:06 +03:00
|
|
|
WORKDIR /go/src/github.com/prometheus/client_golang/examples/simple
|
|
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -tags netgo -ldflags '-w'
|
2022-05-09 11:33:45 +03:00
|
|
|
WORKDIR /go/src/github.com/prometheus/client_golang/examples/gocollector
|
|
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -tags netgo -ldflags '-w'
|
2017-09-19 15:41:00 +03:00
|
|
|
|
|
|
|
# Final image.
|
2019-07-31 04:14:08 +03:00
|
|
|
FROM quay.io/prometheus/busybox:latest
|
2018-08-27 18:28:47 +03:00
|
|
|
LABEL maintainer="The Prometheus Authors <prometheus-developers@googlegroups.com>"
|
2018-07-09 21:09:06 +03:00
|
|
|
COPY --from=builder /go/src/github.com/prometheus/client_golang/examples/random \
|
2022-05-09 11:33:45 +03:00
|
|
|
/go/src/github.com/prometheus/client_golang/examples/simple \
|
|
|
|
/go/src/github.com/prometheus/client_golang/examples/gocollector ./
|
2017-09-19 15:41:00 +03:00
|
|
|
EXPOSE 8080
|
2022-05-09 11:33:45 +03:00
|
|
|
CMD ["echo", "Please run an example. Either /random, /simple or /gocollector"]
|