From acf57aa686c815fd831ff24307d37787d2ec0a59 Mon Sep 17 00:00:00 2001 From: an Date: Wed, 21 Apr 2021 12:18:41 +0200 Subject: [PATCH] add Dockerfile --- Dockerfile | 12 ++++++++++++ main.go | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b778dcf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM golang:latest +MAINTAINER Andreas Neue + +RUN apt -y update && apt -y upgrade && apt-get install -y fortune vim tzdata ca-certificates && apt-get clean +RUN ln -fs /usr/share/zoneinfo/Europe/Berlin /etc/localtime && dpkg-reconfigure -f noninteractive tzdata + +WORKDIR /go/src/covid-exporter +COPY . . +RUN go get -d -v ./... +RUN go install -v ./... + +CMD ["covid-exporter"] diff --git a/main.go b/main.go index 85bcb74..e03442f 100644 --- a/main.go +++ b/main.go @@ -14,6 +14,7 @@ import ( "time" "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promhttp" ) type CovidRecord struct { @@ -127,6 +128,6 @@ func serveMetrics() { ) prometheus.MustRegister(gaugePopulation) - http.Handle("/metrics", prometheus.Handler()) + http.Handle("/metrics", promhttp.Handler()) http.ListenAndServe(":9099", nil) }