From 52a425c3a514102b58777efd2fff326bec1fea5e Mon Sep 17 00:00:00 2001 From: Peter Schiffer Date: Wed, 21 Nov 2018 00:01:51 +0100 Subject: [PATCH] Add base image for ngoduykhanh version of pdns admin --- pdns-admin-base-ngoduykhanh/Dockerfile | 36 +++++++++++++++++++++++ pdns-admin-base-ngoduykhanh/config.py.tpl | 14 +++++++++ 2 files changed, 50 insertions(+) create mode 100644 pdns-admin-base-ngoduykhanh/Dockerfile create mode 100644 pdns-admin-base-ngoduykhanh/config.py.tpl diff --git a/pdns-admin-base-ngoduykhanh/Dockerfile b/pdns-admin-base-ngoduykhanh/Dockerfile new file mode 100644 index 0000000..0a6dd5c --- /dev/null +++ b/pdns-admin-base-ngoduykhanh/Dockerfile @@ -0,0 +1,36 @@ +FROM fedora:29 +MAINTAINER "Peter Schiffer" + +RUN curl -sSL -o /etc/yum.repos.d/yarn.repo https://dl.yarnpkg.com/rpm/yarn.repo + +RUN dnf -y --setopt=install_weak_deps=False install \ + python3-ldap \ + python3-mysql \ + python3-xmlsec \ + uwsgi \ + yarn \ + && dnf clean all + +RUN mkdir -p /opt/powerdns-admin \ + && curl -sSL https://github.com/ngoduykhanh/PowerDNS-Admin/archive/master.tar.gz \ + | tar -xzC /opt/powerdns-admin --strip 1 \ + && sed -i '/python-ldap/d' /opt/powerdns-admin/requirements.txt \ + && chown -R root: /opt/powerdns-admin \ + && chown -R uwsgi: /opt/powerdns-admin/upload + +WORKDIR /opt/powerdns-admin + +RUN pip3 install --no-cache-dir envtpl python-dotenv \ + && pip3 install -r requirements.txt --no-cache-dir + +ENV PDNS_ADMIN_LOG_LEVEL="'INFO'" \ + PDNS_ADMIN_SAML_ENABLED=False + +COPY config.py.tpl / + +RUN envtpl < /config.py.tpl > /opt/powerdns-admin/config.py \ + && sed -i '/SQLALCHEMY_DATABASE_URI/d' /opt/powerdns-admin/config.py + +RUN yarn install --pure-lockfile \ + && flask assets build \ + && chown -R uwsgi: /opt/powerdns-admin/app/static/.webassets-cache diff --git a/pdns-admin-base-ngoduykhanh/config.py.tpl b/pdns-admin-base-ngoduykhanh/config.py.tpl new file mode 100644 index 0000000..2e7ed30 --- /dev/null +++ b/pdns-admin-base-ngoduykhanh/config.py.tpl @@ -0,0 +1,14 @@ +import os +basedir = os.path.abspath(os.path.dirname(__file__)) + +{% for key, value in environment('PDNS_ADMIN_') %}{{ key }} = {{ value }} +{% endfor %} + +WTF_CSRF_ENABLED = True +BIND_ADDRESS = '0.0.0.0' +PORT = 9393 +LOG_FILE = '' +UPLOAD_DIR = '/opt/powerdns-admin/upload' +SQLALCHEMY_DATABASE_URI = 'mysql://' + SQLA_DB_USER + ':' + SQLA_DB_PASSWORD + '@' + SQLA_DB_HOST + ':' + SQLA_DB_PORT + '/' + SQLA_DB_NAME +SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db_repository') +SQLALCHEMY_TRACK_MODIFICATIONS = True