dockerfile: added `BIND_DATA_DIR` environment variable

pull/11/head
Sameer Naik 2015-06-15 20:49:38 +05:30
parent 14f7bc9dff
commit b0bdbce66d
2 changed files with 11 additions and 9 deletions

View File

@ -5,6 +5,8 @@ ENV DATA_DIR=/data \
BIND_USER=bind \
WEBMIN_VERSION=1.740
ENV BIND_DATA_DIR=${DATA_DIR}/bind
RUN rm -rf /etc/apt/apt.conf.d/docker-gzip-indexes \
&& apt-get update \
&& apt-get install -y bind9 perl libnet-ssleay-perl openssl \

18
start
View File

@ -6,22 +6,22 @@ WEBMIN_ENABLED=${WEBMIN_ENABLED:-true}
chmod 775 ${DATA_DIR}
# create directory for bind config
mkdir -p ${DATA_DIR}/bind
chown -R root:${BIND_USER} ${DATA_DIR}/bind
mkdir -p ${BIND_DATA_DIR}
chown -R root:${BIND_USER} ${BIND_DATA_DIR}
# populate default bind configuration if it does not exist
if [ ! -d ${DATA_DIR}/bind/etc ]; then
mv /etc/bind ${DATA_DIR}/bind/etc
if [ ! -d ${BIND_DATA_DIR}/etc ]; then
mv /etc/bind ${BIND_DATA_DIR}/etc
fi
rm -rf /etc/bind
ln -sf ${DATA_DIR}/bind/etc /etc/bind
ln -sf ${BIND_DATA_DIR}/etc /etc/bind
if [ ! -d ${DATA_DIR}/bind/lib ]; then
mkdir -p ${DATA_DIR}/bind/lib
chown root:${BIND_USER} ${DATA_DIR}/bind/lib
if [ ! -d ${BIND_DATA_DIR}/lib ]; then
mkdir -p ${BIND_DATA_DIR}/lib
chown root:${BIND_USER} ${BIND_DATA_DIR}/lib
fi
rm -rf /var/lib/bind
ln -sf ${DATA_DIR}/bind/lib /var/lib/bind
ln -sf ${BIND_DATA_DIR}/lib /var/lib/bind
# create directory for webmin
mkdir -p ${DATA_DIR}/webmin