diff --git a/technitium_dns/Dockerfile b/technitium_dns/Dockerfile index 82fdf9f..2e46ef9 100644 --- a/technitium_dns/Dockerfile +++ b/technitium_dns/Dockerfile @@ -1,12 +1,10 @@ ARG BUILD_FROM=ghcr.io/hassio-addons/base:latest FROM technitium/dns-server:latest -ENV DATA_DIR="/data/dns" \ - DNS_SERVER_WEB_SERVICE_HTTPS_PORT=53443 \ +ENV DNS_SERVER_WEB_SERVICE_HTTPS_PORT=53443 \ DNS_SERVER_WEB_SERVICE_ENABLE_HTTPS=false -RUN mkdir -p /data/dns && \ - ln -sf /data/dns /etc/dns +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh -ENTRYPOINT [] -CMD ["dotnet", "DnsServerApp.dll"] \ No newline at end of file +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/technitium_dns/config.yaml b/technitium_dns/config.yaml index c0a88a5..d8d37f1 100644 --- a/technitium_dns/config.yaml +++ b/technitium_dns/config.yaml @@ -1,5 +1,5 @@ name: Technitium DNS -version: 15.4.0 +version: 15.4.2 slug: technitium_dns description: Technitium DNS Server add-on for Home Assistant arch: diff --git a/technitium_dns/entrypoint.sh b/technitium_dns/entrypoint.sh new file mode 100644 index 0000000..8820665 --- /dev/null +++ b/technitium_dns/entrypoint.sh @@ -0,0 +1,22 @@ +#!/bin/sh +set -e + +# Technitium ships /etc/dns as a real directory in the image. We need it +# to point at the persistent HA add-on config volume instead. Remove the +# directory and replace with a symlink at runtime (after HA mounts volumes). + +DATA="/config/dns" + +mkdir -p "$DATA" + +if [ -d /etc/dns ] && [ ! -L /etc/dns ]; then + # Seed: copy any existing default config into the volume on first run + if [ -z "$(ls -A "$DATA" 2>/dev/null)" ]; then + cp -a /etc/dns/. "$DATA"/ + fi + rm -rf /etc/dns +fi + +ln -sf "$DATA" /etc/dns + +exec dotnet DnsServerApp.dll \ No newline at end of file