diff --git a/deployment/Dockerfile b/deployment/Dockerfile index 50a55a3..9fd0d18 100644 --- a/deployment/Dockerfile +++ b/deployment/Dockerfile @@ -1,9 +1,9 @@ -FROM golang:1.20 as builder +FROM golang:1.21.0-bullseye as builder ENV GO111MODULE=on ENV GOPATH=/root/go RUN mkdir -p /root/go/src -COPY dyndns /root/go/src/dyndns +COPY ../dyndns /root/go/src/dyndns WORKDIR /root/go/src/dyndns # temp sqlite3 error fix ENV CGO_CFLAGS "-g -O2 -Wno-return-local-addr" @@ -13,18 +13,18 @@ RUN GOOS=linux go build -o /root/go/bin/dyndns && go test -v FROM debian:11-slim RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ - apt-get install -q -y bind9 dnsutils curl && \ - apt-get clean + apt-get install -q -y bind9 dnsutils curl libc6 && \ + apt-get clean RUN chmod 770 /var/cache/bind -COPY deployment/setup.sh /root/setup.sh +COPY setup.sh /root/setup.sh RUN chmod +x /root/setup.sh -COPY deployment/named.conf.options /etc/bind/named.conf.options +COPY named.conf.options /etc/bind/named.conf.options WORKDIR /root COPY --from=builder /root/go/bin/dyndns /root/dyndns -COPY dyndns/views /root/views -COPY dyndns/static /root/static +COPY ../dyndns/views /root/views +COPY ../dyndns/static /root/static EXPOSE 53 8080 CMD ["sh", "-c", "/root/setup.sh ; service named start ; /root/dyndns"] diff --git a/deployment/docker-compose.yml b/deployment/docker-compose.yml index 3844e77..4dec656 100644 --- a/deployment/docker-compose.yml +++ b/deployment/docker-compose.yml @@ -8,6 +8,7 @@ services: DDNS_DOMAINS: 'dyndns.example.com' DDNS_PARENT_NS: 'ns.example.com' DDNS_DEFAULT_TTL: '3600' + DDNS_TRANSFER: 'none' ports: - "53:53" - "53:53/udp" diff --git a/deployment/envfile b/deployment/envfile index 8cbdb69..14fb184 100644 --- a/deployment/envfile +++ b/deployment/envfile @@ -1,4 +1,5 @@ DDNS_ADMIN_LOGIN=admin:$$3$$abcdefg DDNS_DOMAINS=dyndns.example.com DDNS_PARENT_NS=ns.example.com -DDNS_DEFAULT_TTL=3600 \ No newline at end of file +DDNS_DEFAULT_TTL=3600 +DDNS_TRANSFER=none diff --git a/deployment/setup.sh b/deployment/setup.sh index e481852..af8614b 100644 --- a/deployment/setup.sh +++ b/deployment/setup.sh @@ -4,44 +4,45 @@ [ -z "$DDNS_DOMAINS" ] && echo "DDNS_DOMAINS not set" && exit 1; [ -z "$DDNS_PARENT_NS" ] && echo "DDNS_PARENT_NS not set" && exit 1; [ -z "$DDNS_DEFAULT_TTL" ] && echo "DDNS_DEFAULT_TTL not set" && exit 1; +[ -z "$DDNS_TRANSFER" ] && echo "DDNS_TRANSFER not set" && exit 1; DDNS_IP=$(curl icanhazip.com) for d in ${DDNS_DOMAINS//,/ } do - if ! grep 'zone "'$d'"' /etc/bind/named.conf > /dev/null - then - echo "creating zone..."; - cat >> /etc/bind/named.conf < /dev/null + then + echo "creating zone..."; + cat >> /etc/bind/named.conf < /var/cache/bind/$d.zone < /var/cache/bind/$d.zone <