-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create Docker images for the examples
When those are published on Dockerhub, people will be able to start those examples in fewer steps than the current documentation: https://prometheus.io/docs/introduction/getting_started/#starting-up-some-sample-targets While relying on Docker may not be always wished, giving the possibility to quickly start a daemon that exposes metrics can be useful in many tutorials. The simple and random example are build as static binaries and packaged as single binaries in Docker images. This commit tries really hard to limit the number of per-example maintenance work by sharing most of the Makefile to build the Docker images. The tiny top level Makefiles in each example directory are strictly identical. Updates: #347
- v1.20.5
- v1.20.4
- v1.20.3
- v1.20.2
- v1.20.1
- v1.20.0
- v1.19.1
- v1.19.0
- v1.18.0
- v1.17.0
- v1.16.0
- v1.15.1
- v1.15.0
- v1.14.0
- v1.13.1
- v1.13.0
- v1.12.2
- v1.12.1
- v1.12.0
- v1.11.1
- v1.11.0
- v1.10.0
- v1.9.0
- v1.8.0
- v1.7.1
- v1.7.0
- v1.6.0
- v1.5.1
- v1.5.0
- v1.4.1
- v1.4.0
- v1.3.0
- v1.2.1
- v1.2.0
- v1.1.0
- v1.0.0
- v0.9.4
- v0.9.3
- v0.9.2
- v0.9.1
- v0.9.0
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# 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. | ||
FROM golang:1.9.0 AS builder | ||
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' | ||
|
||
# Final image. | ||
FROM scratch | ||
LABEL maintainer "The Prometheus Authors <[email protected]>" | ||
COPY --from=builder /go/src/github.com/prometheus/client_golang/examples/random . | ||
EXPOSE 8080 | ||
ENTRYPOINT ["/random"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# 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. | ||
FROM golang:1.9.0 AS builder | ||
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/simple | ||
RUN CGO_ENABLED=0 GOOS=linux go build -a -tags netgo -ldflags '-w' | ||
|
||
# Final image. | ||
FROM scratch | ||
LABEL maintainer "The Prometheus Authors <[email protected]>" | ||
COPY --from=builder /go/src/github.com/prometheus/client_golang/examples/simple . | ||
EXPOSE 8080 | ||
ENTRYPOINT ["/simple"] |