From 6ec18f5d32b404eece434df05ffc1a476eb34235 Mon Sep 17 00:00:00 2001 From: Christian Fritz Date: Sat, 10 Oct 2020 12:08:22 +0200 Subject: [PATCH] Adds Dockerfile --- Dockerfile | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..549fe1e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM golang:1.15 +RUN git clone https://github.com/chr-fritz/fritzbox_exporter.git /go/src/github.com/chr-fritz/fritzbox_exporter +WORKDIR /go/src/github.com/chr-fritz/fritzbox_exporter +RUN go mod download && \ + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags '-w -extldflags "-static"' -o fritzbox-exporter . + +FROM alpine:latest +RUN apk --no-cache add ca-certificates +COPY --from=0 /go/src/github.com/chr-fritz/fritzbox_exporter/fritzbox-exporter /fritzbox-exporter/ +COPY --from=0 /go/src/github.com/chr-fritz/fritzbox_exporter/*.json /etc/fritzbox-exporter/ +ENTRYPOINT ["/fritzbox-exporter/fritzbox-exporter"] +CMD ["--metrics-file","/etc/fritzbox-exporter/metrics.json","--listen-address","0.0.0.0:8080"]