Added Dockerfile (#5)

This commit is contained in:
Marcelo Almeida 2019-06-17 15:40:24 +01:00 committed by Michael Stapelberg
parent 14cdb8f33e
commit bca1dc5c86
3 changed files with 28 additions and 0 deletions

12
Dockerfile Normal file
View file

@ -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"]

View file

@ -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

10
go.mod Normal file
View file

@ -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
)