mirror of
https://github.com/pschiffe/docker-pdns.git
synced 2025-01-18 11:01:14 +01:00
parent
3c7bada92b
commit
5427e1e1fc
11 changed files with 42 additions and 32 deletions
|
@ -17,6 +17,11 @@ RUN curl -sSL -o /etc/yum.repos.d/yarn.repo https://dl.yarnpkg.com/rpm/yarn.repo
|
||||||
yarn \
|
yarn \
|
||||||
&& dnf clean all
|
&& dnf clean all
|
||||||
|
|
||||||
|
RUN arch=$([ "$(arch)" = 'aarch64' ] && echo -n 'arm64' || echo -n 'x86_64') \
|
||||||
|
&& curl -fsSL https://github.com/kha7iq/subvars/releases/download/v0.1.4/subvars_Linux_${arch}.tar.gz \
|
||||||
|
| tar -xzf - -C /usr/local/bin subvars \
|
||||||
|
&& chmod +x /usr/local/bin/subvars
|
||||||
|
|
||||||
RUN mkdir -p /opt/powerdns-admin \
|
RUN mkdir -p /opt/powerdns-admin \
|
||||||
&& curl -sSL https://github.com/PowerDNS-Admin/PowerDNS-Admin/archive/refs/tags/v0.4.1.tar.gz \
|
&& curl -sSL https://github.com/PowerDNS-Admin/PowerDNS-Admin/archive/refs/tags/v0.4.1.tar.gz \
|
||||||
| tar -xzC /opt/powerdns-admin --strip 1 \
|
| tar -xzC /opt/powerdns-admin --strip 1 \
|
||||||
|
@ -31,7 +36,7 @@ RUN mkdir -p /opt/powerdns-admin \
|
||||||
|
|
||||||
WORKDIR /opt/powerdns-admin
|
WORKDIR /opt/powerdns-admin
|
||||||
|
|
||||||
RUN pip3 install --no-cache-dir envtpl python-dotenv \
|
RUN pip3 install --no-cache-dir python-dotenv \
|
||||||
&& pip3 install -r requirements.txt --no-cache-dir
|
&& pip3 install -r requirements.txt --no-cache-dir
|
||||||
|
|
||||||
ENV FLASK_APP=/opt/powerdns-admin/powerdnsadmin/__init__.py
|
ENV FLASK_APP=/opt/powerdns-admin/powerdnsadmin/__init__.py
|
||||||
|
@ -39,7 +44,7 @@ ENV FLASK_APP=/opt/powerdns-admin/powerdnsadmin/__init__.py
|
||||||
COPY config.py.tpl /
|
COPY config.py.tpl /
|
||||||
COPY run.py .
|
COPY run.py .
|
||||||
|
|
||||||
RUN envtpl < /config.py.tpl > /opt/powerdns-admin/config.py \
|
RUN subvars --prefix 'PDNS_ADMIN_' < /config.py.tpl > /opt/powerdns-admin/config.py \
|
||||||
&& sed -i '/SQLALCHEMY_DATABASE_URI/d' /opt/powerdns-admin/config.py
|
&& sed -i '/SQLALCHEMY_DATABASE_URI/d' /opt/powerdns-admin/config.py
|
||||||
|
|
||||||
RUN yarn install --pure-lockfile --production \
|
RUN yarn install --pure-lockfile --production \
|
||||||
|
|
|
@ -19,15 +19,14 @@ SESSION_TYPE = 'sqlalchemy'
|
||||||
SAML_ENABLED = False
|
SAML_ENABLED = False
|
||||||
|
|
||||||
# Configuration from env vars
|
# Configuration from env vars
|
||||||
{%- for key, value in environment('PDNS_ADMIN_') %}
|
{{ range $key, $value := match "PDNS_ADMIN_" -}}
|
||||||
{%- set v = value | trim('"\'\\') %}
|
{{ $v := $value | trimAll "\"'\\" -}}
|
||||||
{%- if v in ['True', 'False', 'None', '0'] or v | int != 0 %}
|
{{ if or (eq $v "True" "False" "None" "0") (ne ($v | int) 0) -}}
|
||||||
{{ key }} = {{ v }}
|
{{- $key | trimPrefix "PDNS_ADMIN_" }} = {{ $v }}
|
||||||
{%- else %}
|
{{ else -}}
|
||||||
{{ key }} = '{{ v }}'
|
{{- $key | trimPrefix "PDNS_ADMIN_" }} = '{{ $v }}'
|
||||||
{%- endif %}
|
{{ end -}}
|
||||||
{%- endfor %}
|
{{ end }}
|
||||||
|
|
||||||
### DATABASE CONFIG
|
### DATABASE CONFIG
|
||||||
SQLALCHEMY_DATABASE_URI = 'mysql://' + SQLA_DB_USER + ':' + SQLA_DB_PASSWORD + '@' + SQLA_DB_HOST + ':' + str(SQLA_DB_PORT) + '/' + SQLA_DB_NAME
|
SQLALCHEMY_DATABASE_URI = 'mysql://' + SQLA_DB_USER + ':' + SQLA_DB_PASSWORD + '@' + SQLA_DB_HOST + ':' + str(SQLA_DB_PORT) + '/' + SQLA_DB_NAME
|
||||||
SQLALCHEMY_TRACK_MODIFICATIONS = True
|
SQLALCHEMY_TRACK_MODIFICATIONS = True
|
||||||
|
|
|
@ -32,7 +32,7 @@ PDNS_ADMIN_SECRET_KEY="$(cat /root/secret-key)"
|
||||||
|
|
||||||
export PDNS_ADMIN_SECRET_KEY
|
export PDNS_ADMIN_SECRET_KEY
|
||||||
|
|
||||||
envtpl < /config.py.tpl > /opt/powerdns-admin/powerdnsadmin/default_config.py
|
subvars --prefix 'PDNS_ADMIN_' < /config.py.tpl > /opt/powerdns-admin/powerdnsadmin/default_config.py
|
||||||
|
|
||||||
# Initialize DB if needed
|
# Initialize DB if needed
|
||||||
MYSQL_COMMAND="mysql -h ${PDNS_ADMIN_SQLA_DB_HOST} -P ${PDNS_ADMIN_SQLA_DB_PORT} -u ${PDNS_ADMIN_SQLA_DB_USER} -p${PDNS_ADMIN_SQLA_DB_PASSWORD}"
|
MYSQL_COMMAND="mysql -h ${PDNS_ADMIN_SQLA_DB_HOST} -P ${PDNS_ADMIN_SQLA_DB_PORT} -u ${PDNS_ADMIN_SQLA_DB_USER} -p${PDNS_ADMIN_SQLA_DB_PASSWORD}"
|
||||||
|
|
|
@ -2,11 +2,12 @@ FROM fedora:39
|
||||||
|
|
||||||
RUN dnf -y --setopt=install_weak_deps=False install \
|
RUN dnf -y --setopt=install_weak_deps=False install \
|
||||||
pdns-recursor \
|
pdns-recursor \
|
||||||
python3-pip \
|
|
||||||
python3-setuptools \
|
|
||||||
&& dnf clean all
|
&& dnf clean all
|
||||||
|
|
||||||
RUN pip3 install --no-cache-dir envtpl
|
RUN arch=$([ "$(arch)" = 'aarch64' ] && echo -n 'arm64' || echo -n 'x86_64') \
|
||||||
|
&& curl -fsSL https://github.com/kha7iq/subvars/releases/download/v0.1.4/subvars_Linux_${arch}.tar.gz \
|
||||||
|
| tar -xzf - -C /usr/local/bin subvars \
|
||||||
|
&& chmod +x /usr/local/bin/subvars
|
||||||
|
|
||||||
RUN mkdir -p /etc/pdns-recursor/api.d \
|
RUN mkdir -p /etc/pdns-recursor/api.d \
|
||||||
&& chown -R pdns-recursor: /etc/pdns-recursor/api.d \
|
&& chown -R pdns-recursor: /etc/pdns-recursor/api.d \
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
FROM alpine:3.19.0
|
FROM alpine:3.19.0
|
||||||
|
|
||||||
RUN apk add --no-cache \
|
RUN apk add --no-cache \
|
||||||
pdns-recursor \
|
pdns-recursor
|
||||||
py3-pip \
|
|
||||||
python3
|
|
||||||
|
|
||||||
RUN pip3 install --no-cache-dir --break-system-packages envtpl
|
RUN arch=$([ "$(arch)" = 'aarch64' ] && echo -n 'arm64' || echo -n 'x86_64') \
|
||||||
|
&& wget -qO- https://github.com/kha7iq/subvars/releases/download/v0.1.4/subvars_Linux_${arch}.tar.gz \
|
||||||
|
| tar -xzf - -C /usr/local/bin subvars \
|
||||||
|
&& chmod +x /usr/local/bin/subvars
|
||||||
|
|
||||||
RUN mkdir -p /etc/pdns/api.d \
|
RUN mkdir -p /etc/pdns/api.d \
|
||||||
&& chown -R recursor: /etc/pdns/api.d \
|
&& chown -R recursor: /etc/pdns/api.d \
|
||||||
|
|
|
@ -18,7 +18,7 @@ elif [ -f /etc/alpine-release ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create config file from template
|
# Create config file from template
|
||||||
envtpl < /recursor.conf.tpl > $config_file
|
subvars --prefix 'PDNS_' < /recursor.conf.tpl > $config_file
|
||||||
|
|
||||||
# Fix config file ownership
|
# Fix config file ownership
|
||||||
chown ${pdns_user}: $config_file
|
chown ${pdns_user}: $config_file
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
{% for key, value in environment('PDNS_') %}{{ key|replace('_', '-') }}={{ value }}
|
{{ range $key, $value := match "PDNS_" -}}
|
||||||
{% endfor %}
|
{{- $key | trimPrefix "PDNS_" | replace "_" "-" }} = {{ $value }}
|
||||||
|
{{ end -}}
|
||||||
|
|
|
@ -6,11 +6,12 @@ RUN sed -i '/tsflags=nodocs/d' /etc/dnf/dnf.conf \
|
||||||
mariadb \
|
mariadb \
|
||||||
pdns \
|
pdns \
|
||||||
pdns-backend-mysql \
|
pdns-backend-mysql \
|
||||||
python3-pip \
|
|
||||||
python3-setuptools \
|
|
||||||
&& dnf clean all
|
&& dnf clean all
|
||||||
|
|
||||||
RUN pip3 install --no-cache-dir envtpl
|
RUN arch=$([ "$(arch)" = 'aarch64' ] && echo -n 'arm64' || echo -n 'x86_64') \
|
||||||
|
&& curl -fsSL https://github.com/kha7iq/subvars/releases/download/v0.1.4/subvars_Linux_${arch}.tar.gz \
|
||||||
|
| tar -xzf - -C /usr/local/bin subvars \
|
||||||
|
&& chmod +x /usr/local/bin/subvars
|
||||||
|
|
||||||
ENV VERSION=4.8 \
|
ENV VERSION=4.8 \
|
||||||
PDNS_guardian=yes \
|
PDNS_guardian=yes \
|
||||||
|
|
|
@ -4,11 +4,12 @@ RUN apk add --no-cache \
|
||||||
mariadb-client \
|
mariadb-client \
|
||||||
pdns \
|
pdns \
|
||||||
pdns-backend-mysql \
|
pdns-backend-mysql \
|
||||||
pdns-doc \
|
pdns-doc
|
||||||
py3-pip \
|
|
||||||
python3
|
|
||||||
|
|
||||||
RUN pip3 install --no-cache-dir --break-system-packages envtpl
|
RUN arch=$([ "$(arch)" = 'aarch64' ] && echo -n 'arm64' || echo -n 'x86_64') \
|
||||||
|
&& wget -qO- https://github.com/kha7iq/subvars/releases/download/v0.1.4/subvars_Linux_${arch}.tar.gz \
|
||||||
|
| tar -xzf - -C /usr/local/bin subvars \
|
||||||
|
&& chmod +x /usr/local/bin/subvars
|
||||||
|
|
||||||
ENV VERSION=4.8 \
|
ENV VERSION=4.8 \
|
||||||
PDNS_guardian=yes \
|
PDNS_guardian=yes \
|
||||||
|
|
|
@ -85,6 +85,6 @@ if [ "${PDNS_superslave:-no}" == "yes" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create config file from template
|
# Create config file from template
|
||||||
envtpl < /pdns.conf.tpl > /etc/pdns/pdns.conf
|
subvars --prefix 'PDNS_' < /pdns.conf.tpl > /etc/pdns/pdns.conf
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
{% for key, value in environment('PDNS_') %}{{ key|replace('_', '-') }}={{ value }}
|
{{ range $key, $value := match "PDNS_" -}}
|
||||||
{% endfor %}
|
{{- $key | trimPrefix "PDNS_" | replace "_" "-" }} = {{ $value }}
|
||||||
|
{{ end -}}
|
||||||
|
|
Loading…
Reference in a new issue