diff --git a/Dockerfile b/Dockerfile index 9104c9a..acd5152 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,11 @@ FROM ubuntu:trusty MAINTAINER Dave P +ADD start /start + # Install bind and dns utils -RUN apt-get update ; \ +RUN chmod +x /start ; \ + apt-get update ; \ apt-get install -y supervisor bind9 dnsutils ; \ rm /etc/bind/rndc.key ; \ mkdir /var/run/named ; \ @@ -11,8 +14,8 @@ RUN apt-get update ; \ touch /var/log/named.log ; \ chgrp bind /var/log/named.log ; \ chmod 775 /var/log/named.log ; \ - sed -i -e's/include "\/etc\/bind\/named.conf.options";/logging{\n\tchannel simple_log {\n\t\tfile "\/var\/log\/named.log" versions 3 size 5m;\n\t\tseverity info;\n\t\tprint-time yes;\n\t\tprint-severity yes;\n\t\tprint-category yes;\n\t};\n\tcategory default{\n\t\tsimple_log;\n\t};\n};\ninclude "\/etc\/bind\/named.conf.options";/' /etc/bind/named.conf ; \ - mkdir /start.d + mkdir /start.d ; \ + rm -rf /var/lib/apt/lists/* # Supervisor script ADD bind.conf /etc/supervisor/conf.d/bind.conf @@ -21,8 +24,7 @@ ADD supervisor.conf /etc/supervisor/conf.d/supervisor.conf # Bind setup script ADD regen-bind-key /start.d/regen-bind-key -ADD start /start - # DNS port EXPOSE 53/udp +ENTRYPOINT ["/start"] \ No newline at end of file diff --git a/regen-bind-key b/regen-bind-key index dd95ca0..ea58071 100755 --- a/regen-bind-key +++ b/regen-bind-key @@ -1,7 +1,6 @@ #!/bin/bash # reconfigure bind - regenerates secret keys -rndc-confgen -a -r /dev/urandom - -# Only run once -rm /start.d/regen-bind-key +if [ ! -f /etc/bind/rndc.key ]; then + rndc-confgen -a -r /dev/urandom +fi