From 17595f6333211c32543904c86a98634c285fc1d0 Mon Sep 17 00:00:00 2001 From: mathias petermann Date: Thu, 18 Mar 2021 20:57:29 +0100 Subject: [PATCH] Add dockerfile --- Dockerfile | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..21f9383 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM golang:alpine as build + +WORKDIR /root +COPY . /root +RUN go build . + +FROM alpine:latest + +ENV SWITCH_IP_ADDRESS="192.168.10.10" LISTEN_ADDRESS="0.0.0.0" LISTEN_PORT="9452" + +RUN addgroup -S mystrom \ + && adduser -S mystrom -G mystrom \ + && mkdir /app \ + && chown -R mystrom:mystrom /app + +WORKDIR /app +USER mystrom +COPY --from=build /root/mystrom-exporter /app + +CMD /app/mystrom-exporter -web.listen-address $LISTEN_ADDRESS:$LISTEN_PORT -switch.ip-address $SWITCH_IP_ADDRESS \ No newline at end of file