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
6# Builder image, where we build the example.
7FROM golang:1 AS builder
8WORKDIR /go/src/github.com/prometheus/client_golang
9COPY . .
10WORKDIR /go/src/github.com/prometheus/client_golang/prometheus
11RUN go get -d
12WORKDIR /go/src/github.com/prometheus/client_golang/examples/random
13RUN CGO_ENABLED=0 GOOS=linux go build -a -tags netgo -ldflags '-w'
14WORKDIR /go/src/github.com/prometheus/client_golang/examples/simple
15RUN CGO_ENABLED=0 GOOS=linux go build -a -tags netgo -ldflags '-w'
16
17# Final image.
18FROM quay.io/prometheus/busybox:latest
19LABEL maintainer="The Prometheus Authors <prometheus-developers@googlegroups.com>"
20COPY --from=builder /go/src/github.com/prometheus/client_golang/examples/random \
21    /go/src/github.com/prometheus/client_golang/examples/simple ./
22EXPOSE 8080
23CMD ["echo", "Please run an example. Either /random or /simple"]
24