diff --git a/fritzbox-exporter-docker/Dockerfile b/fritzbox-exporter-docker/Dockerfile new file mode 100644 index 0000000..b54d710 --- /dev/null +++ b/fritzbox-exporter-docker/Dockerfile @@ -0,0 +1,38 @@ +# syntax=docker/dockerfile:1 + +# Build Image +FROM golang:alpine3.15 AS builder +RUN go install github.com/sberk42/fritzbox_exporter@latest \ + && mkdir /app \ + && mv /go/bin/fritzbox_exporter /app + +WORKDIR /app + +COPY metrics.json metrics-lua.json /app/ + +# Runtime Image +FROM alpine:3.15 as runtime-image + +ARG REPO=sberk42/fritzbox_exporter + +LABEL org.opencontainers.image.source https://github.com/${REPO} + +ENV USERNAME username +ENV PASSWORD password +ENV GATEWAY_URL http://fritz.box:49000 +ENV LISTEN_ADDRESS 0.0.0.0:9042 + +RUN mkdir /app \ + && addgroup -S -g 1000 fritzbox \ + && adduser -S -u 1000 -G fritzbox fritzbox \ + && chown -R fritzbox:fritzbox /app + +WORKDIR /app + +COPY --chown=fritzbox:fritzbox --from=builder /app /app + +EXPOSE 9042 + +ENTRYPOINT [ "sh", "-c", "/app/fritzbox_exporter" ] +CMD [ "-username", "${USERNAME}", "-password", "${PASSWORD}", "-gateway-url", "${GATEWAY_URL}", "-listen-address", "${LISTEN_ADDRESS}" ] + diff --git a/fritzbox-exporter-docker/docker-compose.yml b/fritzbox-exporter-docker/docker-compose.yml index e1e1bf1..23a06bb 100644 --- a/fritzbox-exporter-docker/docker-compose.yml +++ b/fritzbox-exporter-docker/docker-compose.yml @@ -6,7 +6,7 @@ services: context: . dockerfile: Dockerfile container_name: fritzbox-prometheus-exporter - # for dns issues like "dial tcp: lookup fritz.box on 127.0.0.11:53: no such host" + # . for dns issues like "dial tcp: lookup fritz.box on 127.0.0.11:53: no such host" # uncomment and fill the following line: # dns: YOUR_FRITZBOX_IP ports: