diff --git a/Dockerfile b/Dockerfile index 3a9649f..b3b7d7f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,7 @@ RUN set -ex \ git \ make \ && go get -v \ + github.com/Luzifer/bind-log-metrics \ github.com/Luzifer/named-blacklist \ github.com/Luzifer/rootzone \ && rootzone >named.stubs \ @@ -30,10 +31,11 @@ RUN set -ex \ bind-tools \ && /usr/local/bin/build.sh -COPY --from=builder /src/named.stubs /etc/bind/ -COPY --from=builder /src/named.blacklist /etc/bind/ -COPY named.conf /etc/bind/ -COPY docker-entrypoint.sh /usr/local/bin/ +COPY --from=builder /go/bin/bind-log-metrics /usr/local/bin/ +COPY --from=builder /src/named.stubs /etc/bind/ +COPY --from=builder /src/named.blacklist /etc/bind/ +COPY named.conf /etc/bind/ +COPY docker-entrypoint.sh /usr/local/bin/ EXPOSE 53/udp 53 diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 2eff838..8765a4b 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,5 +1,11 @@ #!/usr/local/bin/dumb-init /bin/bash set -euxo pipefail +# No influx credentials present, don't use metrics sender +[[ -n ${INFLUX_HOST:-} ]] || + exec named -c /etc/bind/named.conf -g + # Start bind -exec named -c /etc/bind/named.conf -g +bind-log-metrics <( + named -c /etc/bind/named.conf -g 2>&1 +)