From 1bc71085adbae3e47d8f4e421df977dcab330679 Mon Sep 17 00:00:00 2001 From: Rob Best Date: Sat, 2 Dec 2017 19:03:36 +0000 Subject: [PATCH] It looks like there's a standard approach most Prometheus exporters use when building Dockerfiles, so I'm going to adhere to that. Rather than building the binary inside the container, it's built outside and then copied into the bin dir. --- Dockerfile | 21 +++------------------ README.md | 5 +++++ 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index ed5f0c9..a523857 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,5 @@ -FROM golang:1.8.3-alpine3.6 as builder +FROM quay.io/prometheus/busybox:latest -ENV GOOS=linux GOARCH=amd64 GOPATH=/go +COPY ssl_exporter /bin/ssl_exporter -WORKDIR /go/src/github.com/ribbybibby/ssl_exporter - -RUN apk --no-cache --quiet add git -RUN go get "github.com/prometheus/client_golang/prometheus" "gopkg.in/alecthomas/kingpin.v2" "github.com/sirupsen/logrus" - -COPY . /go/src/github.com/ribbybibby/ssl_exporter - -RUN go build - -FROM alpine:3.6 - -RUN apk add --quiet --no-cache ca-certificates tzdata && rm -rf /var/cache/apk/* - -COPY --from=builder /go/src/github.com/ribbybibby/ssl_exporter/ssl_exporter /ssl_exporter - -ENTRYPOINT ["/ssl_exporter"] +ENTRYPOINT ["/bin/ssl_exporter"] diff --git a/README.md b/README.md index c7d059c..1a80329 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,11 @@ Whatever it is, the SSL exporter gives you visibility over those dimensions at t ## Building make ./ssl_exporter + +### Docker + make all docker + docker run -p 9219:9219 ssl-exporter:master + Similarly to the blackbox_exporter, visiting [http://localhost:9219/probe?target=https://example.com](http://localhost:9219/probe?target=https://example.com) will return certificate metrics for example.com. The ```ssl_https_connect_success``` metric indicates if the probe has been successful. ## Flags