...
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 Dockerfile -t prometheus/golang-example .
5
6# Run as
7# docker run -P prometheus/golang-example /random
8# or
9# docker run -P prometheus/golang-example /simple
10
11# Test as
12# curl $ip:$port/metrics
13
14# Builder image, where we build the example.
15FROM golang:1 AS builder
16WORKDIR /go/src/github.com/prometheus/client_golang
17COPY . .
18WORKDIR /go/src/github.com/prometheus/client_golang/prometheus
19RUN go get -d
20WORKDIR /go/src/github.com/prometheus/client_golang/examples/random
21RUN CGO_ENABLED=0 GOOS=linux go build -a -tags netgo -ldflags '-w'
22WORKDIR /go/src/github.com/prometheus/client_golang/examples/simple
23RUN CGO_ENABLED=0 GOOS=linux go build -a -tags netgo -ldflags '-w'
24WORKDIR /go/src/github.com/prometheus/client_golang/examples/gocollector
25RUN CGO_ENABLED=0 GOOS=linux go build -a -tags netgo -ldflags '-w'
26
27# Final image.
28FROM quay.io/prometheus/busybox:latest
29LABEL maintainer="The Prometheus Authors <prometheus-developers@googlegroups.com>"
30COPY --from=builder /go/src/github.com/prometheus/client_golang/examples/random \
31 /go/src/github.com/prometheus/client_golang/examples/simple \
32 /go/src/github.com/prometheus/client_golang/examples/gocollector ./
33EXPOSE 8080
34CMD ["echo", "Please run an example. Either /random, /simple or /gocollector"]
View as plain text