add Dockerfile
This commit is contained in:
parent
4b7ae0ef92
commit
acf57aa686
|
@ -0,0 +1,12 @@
|
||||||
|
FROM golang:latest
|
||||||
|
MAINTAINER Andreas Neue <an@dnix.de>
|
||||||
|
|
||||||
|
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"]
|
3
main.go
3
main.go
|
@ -14,6 +14,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CovidRecord struct {
|
type CovidRecord struct {
|
||||||
|
@ -127,6 +128,6 @@ func serveMetrics() {
|
||||||
)
|
)
|
||||||
prometheus.MustRegister(gaugePopulation)
|
prometheus.MustRegister(gaugePopulation)
|
||||||
|
|
||||||
http.Handle("/metrics", prometheus.Handler())
|
http.Handle("/metrics", promhttp.Handler())
|
||||||
http.ListenAndServe(":9099", nil)
|
http.ListenAndServe(":9099", nil)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue