Remove base image dependency

This commit is contained in:
dpedu 2015-09-07 21:26:49 -07:00
parent e7bfb6fae2
commit 4e04c84a5f
4 changed files with 26 additions and 12 deletions

View File

@ -1,15 +1,9 @@
FROM basessh
FROM ubuntu:trusty
MAINTAINER Dave P
# Bind setup script
COPY regen-bind-key /start.d/regen-bind-key
# Supervisor script
COPY bind.conf /etc/supervisor/conf.d/bind.conf
# Install bind and dns utils
RUN apt-get update ; \
apt-get install -y bind9 dnsutils ; \
apt-get install -y supervisor bind9 dnsutils ; \
rm /etc/bind/rndc.key ; \
chmod +x /start.d/regen-bind-key ; \
mkdir /var/run/named ; \
@ -18,8 +12,17 @@ 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
# edit named.conf to use the above log file
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
# Supervisor script
ADD bind.conf /etc/supervisor/conf.d/bind.conf
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

3
regen-bind-key Normal file → Executable file
View File

@ -1,8 +1,7 @@
#!/bin/bash
# reconfigure bind - regenerates secret keys
dpkg-reconfigure bind9
rndc-confgen -a -r /dev/urandom
# Only run once
rm /start.d/regen-bind-key

10
start Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
# run everything in start.d
find /start.d -type f -executable -exec {} \;
# Cleanly kill supervisor when container is stopped
trap 'kill $(jobs -p)' EXIT
# start services
supervisord

2
supervisor.conf Normal file
View File

@ -0,0 +1,2 @@
[supervisord]
nodaemon=true