From e07ffde41331db85e7283af5a5e0856004fc5f01 Mon Sep 17 00:00:00 2001 From: Steve HOLWEG Date: Mon, 11 Dec 2017 14:18:53 +0100 Subject: [PATCH] Add alpine base dockerfile (#7) * Add alpine base dockerfile * Adding missing package for mysql init --- pdns-admin-uwsgi/Dockerfile.alpine | 50 ++++++++++++++++++++++++++++++ pdns-admin-uwsgi/docker-cmd.sh | 2 +- pdns/Dockerfile.alpine | 23 ++++++++++++++ pdns/docker-cmd.sh | 2 +- 4 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 pdns-admin-uwsgi/Dockerfile.alpine create mode 100644 pdns/Dockerfile.alpine diff --git a/pdns-admin-uwsgi/Dockerfile.alpine b/pdns-admin-uwsgi/Dockerfile.alpine new file mode 100644 index 0000000..0787ac5 --- /dev/null +++ b/pdns-admin-uwsgi/Dockerfile.alpine @@ -0,0 +1,50 @@ +FROM alpine:3.7 +MAINTAINER "Peter Schiffer" + +RUN set -xe \ + && apk update --no-cache && apk upgrade --no-cache \ + && apk add --update --no-cache \ + curl \ + py-pip \ + uwsgi-python \ + py-mysqldb \ + py-pyldap \ + py-cffi \ + py-bcrypt \ + mariadb-client \ + && rm -rf /var/cache/apk/* + +RUN mkdir -p /opt/powerdns-admin \ + && curl -sSL https://git.0x97.io/0x97/powerdns-admin/repository/master/archive.tar.gz \ + | tar -xzC /opt/powerdns-admin --strip 1 \ + && sed -i '/MySQL-python/d' /opt/powerdns-admin/requirements.txt \ + && sed -i '/python-ldap/d' /opt/powerdns-admin/requirements.txt \ + && sed -i '/bcrypt/d' /opt/powerdns-admin/requirements.txt \ + && chown -R root: /opt/powerdns-admin \ + && chown -R uwsgi: /opt/powerdns-admin/upload + +WORKDIR /opt/powerdns-admin + +RUN pip install envtpl \ + && pip install -r requirements.txt \ + && rm -rf ~/.cache/* + +ENV PDNS_ADMIN_LOGIN_TITLE="'PDNS'" \ + PDNS_ADMIN_TIMEOUT=10 \ + PDNS_ADMIN_LOG_LEVEL="'INFO'" \ + PDNS_ADMIN_BASIC_ENABLED=True \ + PDNS_ADMIN_SIGNUP_ENABLED=True \ + PDNS_ADMIN_RECORDS_ALLOW_EDIT="['SOA', 'NS', 'A', 'AAAA', 'CNAME', 'MX', 'TXT', 'SRV']" + +EXPOSE 9494 + +VOLUME [ "/opt/powerdns-admin/upload" ] + +COPY pdns-admin.ini /etc/uwsgi/conf.d/ +RUN chown uwsgi: /etc/uwsgi/conf.d/pdns-admin.ini && \ + ln -s /etc/uwsgi/uwsgi.ini /etc/uwsgi.ini + +COPY config.py.tpl / +COPY docker-cmd.sh / + +CMD [ "/docker-cmd.sh" ] \ No newline at end of file diff --git a/pdns-admin-uwsgi/docker-cmd.sh b/pdns-admin-uwsgi/docker-cmd.sh index f65a268..b8afa11 100755 --- a/pdns-admin-uwsgi/docker-cmd.sh +++ b/pdns-admin-uwsgi/docker-cmd.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh set -euo pipefail diff --git a/pdns/Dockerfile.alpine b/pdns/Dockerfile.alpine new file mode 100644 index 0000000..0400ff8 --- /dev/null +++ b/pdns/Dockerfile.alpine @@ -0,0 +1,23 @@ +FROM alpine:3.7 +MAINTAINER "Peter Schiffer" + +RUN set -xe \ + && apk update --no-cache && apk upgrade --no-cache \ + && apk add --update --no-cache pdns pdns-backend-mysql pdns-doc python3 mariadb-client \ + && rm -rf /var/cache/apk/* + +RUN pip3 install envtpl \ + && rm -rf ~/.cache/* + +ENV VERSION=4.0.4 \ + PDNS_guardian=yes \ + PDNS_setuid=pdns \ + PDNS_setgid=pdns \ + PDNS_launch=gmysql + +EXPOSE 53 53/udp + +COPY pdns.conf.tpl / +COPY docker-cmd.sh / + +CMD [ "/docker-cmd.sh" ] diff --git a/pdns/docker-cmd.sh b/pdns/docker-cmd.sh index 58e5f9a..4b90959 100755 --- a/pdns/docker-cmd.sh +++ b/pdns/docker-cmd.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh set -euo pipefail