Update / fix pdns-recursor image

This commit is contained in:
Peter Schiffer 2018-11-06 22:51:45 +01:00
parent a0038d10d8
commit e615b8318c
No known key found for this signature in database
GPG key ID: 6CCC5046E2B0B44B
3 changed files with 25 additions and 24 deletions

View file

@ -1,19 +1,18 @@
FROM fedora:27
MAINTAINER "Peter Schiffer" <pschiffe@redhat.com>
FROM fedora:29
MAINTAINER "Peter Schiffer" <peter@rfv.sk>
RUN dnf -y --setopt=install_weak_deps=False install \
pdns-recursor \
&& dnf clean all
RUN pip3 install envtpl \
&& rm -rf ~/.cache/*
RUN pip3 install --no-cache-dir envtpl
RUN mkdir -p /etc/pdns/api.d \
&& chown -R pdns-recursor:pdns-recursor /etc/pdns/api.d
RUN mkdir -p /etc/pdns-recursor/api.d \
&& chown -R pdns-recursor: /etc/pdns-recursor/api.d
ENV VERSION=4.0 \
PDNS_setuid=recursor \
PDNS_setgid=recursor \
ENV VERSION=4.1 \
PDNS_setuid=pdns-recursor \
PDNS_setgid=pdns-recursor \
PDNS_daemon=no
EXPOSE 53 53/udp

View file

@ -1,15 +1,14 @@
FROM alpine:3.8
MAINTAINER "Peter Schiffer" <pschiffe@redhat.com>
MAINTAINER "Peter Schiffer" <peter@rfv.sk>
RUN apk add --no-cache \
pdns-recursor \
python3
RUN pip3 install envtpl \
&& rm -rf ~/.cache/*
RUN pip3 install --no-cache-dir envtpl
RUN mkdir -p /etc/pdns/api.d \
&& chown -R recursor:recursor /etc/pdns/api.d
&& chown -R recursor: /etc/pdns/api.d
ENV VERSION=4.1 \
PDNS_setuid=recursor \

View file

@ -5,19 +5,22 @@ set -euo pipefail
# Configure base vars
: "${PDNS_local_port:=53}"
: "${PDNS_local_address:=0.0.0.0}"
: "${PDNS_allow_from:=0.0.0.0/0}"
export PDNS_local_port PDNS_local_address
export PDNS_local_port PDNS_local_address PDNS_allow_from
# Create config file from template
envtpl < /recursor.conf.tpl > /etc/pdns/recursor.conf
# fix config right
if getent passwd | grep -q '^pdns-recursor:'; then
# Fedora user
chown pdns-recursor:pdns-recursor /etc/pdns/recursor.conf
else
# Alpine user
chown recursor:recursor /etc/pdns/recursor.conf
if [ -f /etc/fedora-release ]; then
config_file=/etc/pdns-recursor/recursor.conf
pdns_user=pdns-recursor
elif [ -f /etc/alpine-release ]; then
config_file=/etc/pdns/recursor.conf
pdns_user=recursor
fi
# Create config file from template
envtpl < /recursor.conf.tpl > $config_file
# Fix config file ownership
chown ${pdns_user}: $config_file
exec /usr/sbin/pdns_recursor