From bca1dc5c86d781f4e83498e33efa520b4f771361 Mon Sep 17 00:00:00 2001 From: Marcelo Almeida <11047924+marceloalmeida@users.noreply.github.com> Date: Mon, 17 Jun 2019 15:40:24 +0100 Subject: [PATCH] Added Dockerfile (#5) --- Dockerfile | 12 ++++++++++++ README.md | 6 ++++++ go.mod | 10 ++++++++++ 3 files changed, 28 insertions(+) create mode 100644 Dockerfile create mode 100644 go.mod diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3d4c5c8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +# build stage +FROM golang:1.12.6-stretch AS build-env +ADD . /src +ENV CGO_ENABLED=0 +WORKDIR /src +RUN go build -o dnsmasq_exporter + +# final stage +FROM scratch +WORKDIR /app +COPY --from=build-env /src/dnsmasq_exporter /app/ +ENTRYPOINT ["/app/dnsmasq_exporter"] diff --git a/README.md b/README.md index 0b94b3b..55f0a7f 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,12 @@ systemctl daemon-reload systemctl enable --now dnsmasq_exporter ``` +### Alternative usage +```shell +docker build -t dnsmasq_exporter . +docker run --restart=unless-stopped --net=host dnsmasq_exporter +``` + Then, add the endpoint to your Prometheus configuration file: ```yaml diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..e9e1ab0 --- /dev/null +++ b/go.mod @@ -0,0 +1,10 @@ +module github.com/google/dnsmasq_exporter + +go 1.12 + +require ( + github.com/miekg/dns v1.1.14 + github.com/prometheus/client_golang v0.9.4 + github.com/prometheus/common v0.4.1 + golang.org/x/sync v0.0.0-20190423024810-112230192c58 +)