commit 68610cc0512757daf18c17f4ff1cef1d236bd4a2 Author: n0vember Date: Tue Mar 12 01:07:29 2024 +0100 initial diff --git a/dockerfile b/dockerfile new file mode 100644 index 0000000..c244c2a --- /dev/null +++ b/dockerfile @@ -0,0 +1,22 @@ +FROM alpine as build-pihole-exporter + +WORKDIR /build + +RUN apk update +RUN apk add go + +ENV GOPATH /build +RUN go install github.com/eko/pihole-exporter@latest + +FROM alpine +COPY --from=build-pihole-exporter "/build/bin/pihole-exporter" /bin + +RUN apk update +run apk add bash + +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh +ENTRYPOINT ["/bin/bash"] + +EXPOSE ${PORT} +CMD ["/entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..dadc0c4 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +pihole_host=${PIHOLE:-pihole} +pihole_pass=${PASS:-password1234} +exporter_port=${PORT:-9617} + +if [ -n "${PASS_FILE}" ] ; then + pihole_pass=$(cat ${PASS_FILE}) +fi + +exec /bin/pihole-exporter \ + -pihole_hostname ${pihole_host} \ + -pihole_password ${pihole_pass} \ + -port ${exporter_port}