This commit is contained in:
n0vember 2024-03-12 01:07:29 +01:00
commit 68610cc051
No known key found for this signature in database
GPG Key ID: 8ECF21687C8F8994
2 changed files with 36 additions and 0 deletions

22
dockerfile Normal file
View File

@ -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"]

14
entrypoint.sh Normal file
View File

@ -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}