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):
|
2022-03-16 13:14:51 +03:00
|
|
|
# docker build -f Dockerfile -t prometheus/golang-example .
|
|
|
|
|
|
|
|
# Run as
|
|
|
|
# docker run -P prometheus/golang-example /random
|
|
|
|
# or
|
|
|
|
# docker run -P prometheus/golang-example /simple
|
|
|
|
|
|
|
|
# Test as
|
|
|
|
# curl $ip:$port/metrics
|
2017-09-19 15:41:00 +03:00
|
|
|
|
|
|
|
# Builder image, where we build the example.
|
2018-07-09 21:09:06 +03:00
|
|
|
FROM golang:1 AS builder
|
2022-12-13 11:48:40 +03:00
|
|
|
WORKDIR /go/src/git.internal/re/client_golang
|
2017-09-19 15:41:00 +03:00
|
|
|
COPY . .
|
2022-12-13 11:48:40 +03:00
|
|
|
WORKDIR /go/src/git.internal/re/client_golang/prometheus
|
2017-09-19 15:41:00 +03:00
|
|
|
RUN go get -d
|
2022-12-13 11:48:40 +03:00
|
|
|
WORKDIR /go/src/git.internal/re/client_golang/examples/random
|
2017-09-19 15:41:00 +03:00
|
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -tags netgo -ldflags '-w'
|
2022-12-13 11:48:40 +03:00
|
|
|
WORKDIR /go/src/git.internal/re/client_golang/examples/simple
|
2018-07-09 21:09:06 +03:00
|
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -tags netgo -ldflags '-w'
|
2022-12-13 11:48:40 +03:00
|
|
|
WORKDIR /go/src/git.internal/re/client_golang/examples/gocollector
|
2022-05-09 11:33:45 +03:00
|
|
|
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>"
|
2022-12-13 11:48:40 +03:00
|
|
|
COPY --from=builder /go/src/git.internal/re/client_golang/examples/random \
|
|
|
|
/go/src/git.internal/re/client_golang/examples/simple \
|
|
|
|
/go/src/git.internal/re/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"]
|