From 15d3225d6185b102f6d5abb149cb7fb7763cb088 Mon Sep 17 00:00:00 2001 From: Peter Schiffer <3899107+pschiffe@users.noreply.github.com> Date: Tue, 19 Dec 2023 22:20:10 +0100 Subject: [PATCH] Tidy up Dockerfiles --- pdns-admin-base-ngoduykhanh/Dockerfile | 27 ++++++++++++++---------- pdns-admin-static-ngoduykhanh/Dockerfile | 3 +-- pdns-admin-uwsgi-ngoduykhanh/Dockerfile | 9 ++++---- pdns-recursor/Dockerfile | 17 +++++++-------- pdns-recursor/Dockerfile.alpine | 17 +++++++-------- pdns/Dockerfile | 13 ++++++------ pdns/Dockerfile.alpine | 12 ++++++----- 7 files changed, 51 insertions(+), 47 deletions(-) diff --git a/pdns-admin-base-ngoduykhanh/Dockerfile b/pdns-admin-base-ngoduykhanh/Dockerfile index 8919b4a..5804db0 100644 --- a/pdns-admin-base-ngoduykhanh/Dockerfile +++ b/pdns-admin-base-ngoduykhanh/Dockerfile @@ -1,7 +1,10 @@ FROM fedora:38 -RUN curl -sSL -o /etc/yum.repos.d/yarn.repo https://dl.yarnpkg.com/rpm/yarn.repo \ - && dnf -y --setopt=install_weak_deps=False install \ +RUN echo 'install_weak_deps=False' >> /etc/dnf/dnf.conf \ + && echo 'assumeyes=True' >> /etc/dnf/dnf.conf \ + && curl -fsSL -o /etc/yum.repos.d/yarn.repo https://dl.yarnpkg.com/rpm/yarn.repo \ + && dnf --refresh upgrade \ + && dnf install \ nodejs-npm \ python3-cffi \ python3-ldap \ @@ -23,15 +26,17 @@ RUN arch=$([ "$(arch)" = 'aarch64' ] && echo -n 'arm64' || echo -n 'x86_64') \ && chmod +x /usr/local/bin/subvars RUN mkdir -p /opt/powerdns-admin \ - && curl -sSL https://github.com/PowerDNS-Admin/PowerDNS-Admin/archive/refs/tags/v0.4.1.tar.gz \ - | tar -xzC /opt/powerdns-admin --strip 1 \ - && sed -i '/cffi/d' /opt/powerdns-admin/requirements.txt \ - && sed -i '/lxml/d' /opt/powerdns-admin/requirements.txt \ - && sed -i '/mysqlclient/d' /opt/powerdns-admin/requirements.txt \ - && sed -i '/psycopg2/d' /opt/powerdns-admin/requirements.txt \ - && sed -i '/python-ldap/d' /opt/powerdns-admin/requirements.txt \ - && sed -i '/python3-saml/d' /opt/powerdns-admin/requirements.txt \ - && sed -i '/PyYAML/d' /opt/powerdns-admin/requirements.txt \ + && curl -fsSL https://github.com/PowerDNS-Admin/PowerDNS-Admin/archive/refs/tags/v0.4.1.tar.gz \ + | tar -xzf - -C /opt/powerdns-admin --strip 1 \ + && sed -i \ + -e '/cffi/d' \ + -e '/lxml/d' \ + -e '/mysqlclient/d' \ + -e '/psycopg2/d' \ + -e '/python-ldap/d' \ + -e '/python3-saml/d' \ + -e '/PyYAML/d' \ + /opt/powerdns-admin/requirements.txt \ && chown -R root: /opt/powerdns-admin WORKDIR /opt/powerdns-admin diff --git a/pdns-admin-static-ngoduykhanh/Dockerfile b/pdns-admin-static-ngoduykhanh/Dockerfile index ce1a15f..2ff7d47 100644 --- a/pdns-admin-static-ngoduykhanh/Dockerfile +++ b/pdns-admin-static-ngoduykhanh/Dockerfile @@ -1,7 +1,6 @@ FROM pschiffe/pdns-admin-base -RUN dnf -y --setopt=install_weak_deps=False install \ - nginx \ +RUN dnf install nginx \ && dnf clean all COPY pdns-nginx.conf.tpl docker-entrypoint.sh / diff --git a/pdns-admin-uwsgi-ngoduykhanh/Dockerfile b/pdns-admin-uwsgi-ngoduykhanh/Dockerfile index bb58f81..a9ee14e 100644 --- a/pdns-admin-uwsgi-ngoduykhanh/Dockerfile +++ b/pdns-admin-uwsgi-ngoduykhanh/Dockerfile @@ -1,15 +1,14 @@ FROM pschiffe/pdns-admin-base -RUN dnf -y --setopt=install_weak_deps=False install \ +RUN dnf install \ mariadb \ uwsgi-plugin-python3 \ && dnf clean all -EXPOSE 9494 - COPY docker-entrypoint.sh / -COPY pdns-admin.ini /etc/uwsgi.ini -RUN chown uwsgi: /etc/uwsgi.ini +COPY --chown=uwsgi:uwsgi pdns-admin.ini /etc/uwsgi.ini + +EXPOSE 9494 ENTRYPOINT [ "/docker-entrypoint.sh" ] diff --git a/pdns-recursor/Dockerfile b/pdns-recursor/Dockerfile index de37ad9..e6eb9fa 100644 --- a/pdns-recursor/Dockerfile +++ b/pdns-recursor/Dockerfile @@ -1,7 +1,9 @@ FROM fedora:39 -RUN dnf -y --setopt=install_weak_deps=False install \ - pdns-recursor \ +RUN echo 'install_weak_deps=False' >> /etc/dnf/dnf.conf \ + && echo 'assumeyes=True' >> /etc/dnf/dnf.conf \ + && dnf --refresh upgrade \ + && dnf install pdns-recursor \ && dnf clean all RUN arch=$([ "$(arch)" = 'aarch64' ] && echo -n 'arm64' || echo -n 'x86_64') \ @@ -9,10 +11,10 @@ RUN arch=$([ "$(arch)" = 'aarch64' ] && echo -n 'arm64' || echo -n 'x86_64') \ | tar -xzf - -C /usr/local/bin subvars \ && chmod +x /usr/local/bin/subvars -RUN mkdir -p /etc/pdns-recursor/api.d \ - && chown -R pdns-recursor: /etc/pdns-recursor/api.d \ - && mkdir -p /run/pdns-recursor \ - && chown -R pdns-recursor: /run/pdns-recursor +RUN mkdir -p /etc/pdns-recursor/api.d /run/pdns-recursor \ + && chown -R pdns-recursor: /etc/pdns-recursor/api.d /run/pdns-recursor + +COPY recursor.conf.tpl docker-entrypoint.sh / ENV VERSION=4.9 \ PDNS_setuid=pdns-recursor \ @@ -21,9 +23,6 @@ ENV VERSION=4.9 \ EXPOSE 53 53/udp -COPY recursor.conf.tpl / -COPY docker-entrypoint.sh / - ENTRYPOINT [ "/docker-entrypoint.sh" ] CMD [ "/usr/sbin/pdns_recursor" ] diff --git a/pdns-recursor/Dockerfile.alpine b/pdns-recursor/Dockerfile.alpine index 4198b91..f3bd3f8 100644 --- a/pdns-recursor/Dockerfile.alpine +++ b/pdns-recursor/Dockerfile.alpine @@ -1,17 +1,19 @@ FROM alpine:3.19.0 -RUN apk add --no-cache \ - pdns-recursor +RUN apk update \ + && apk upgrade \ + && apk add pdns-recursor \ + && rm -rf /var/cache/apk/* 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 \ - && chown -R recursor: /etc/pdns/api.d \ - && mkdir -p /var/run/pdns-recursor \ - && chown -R recursor: /var/run/pdns-recursor +RUN mkdir -p /etc/pdns/api.d /var/run/pdns-recursor \ + && chown -R recursor: /etc/pdns/api.d /var/run/pdns-recursor + +COPY recursor.conf.tpl docker-entrypoint.sh / ENV VERSION=4.9 \ PDNS_setuid=recursor \ @@ -20,9 +22,6 @@ ENV VERSION=4.9 \ EXPOSE 53 53/udp -COPY recursor.conf.tpl / -COPY docker-entrypoint.sh / - ENTRYPOINT [ "/docker-entrypoint.sh" ] CMD [ "/usr/sbin/pdns_recursor" ] diff --git a/pdns/Dockerfile b/pdns/Dockerfile index 85a683c..92cbc18 100644 --- a/pdns/Dockerfile +++ b/pdns/Dockerfile @@ -1,11 +1,13 @@ FROM fedora:39 -RUN sed -i '/tsflags=nodocs/d' /etc/dnf/dnf.conf \ - && dnf -y --setopt=install_weak_deps=False install \ +RUN echo 'install_weak_deps=False' >> /etc/dnf/dnf.conf \ + && echo 'assumeyes=True' >> /etc/dnf/dnf.conf \ + && dnf --refresh upgrade \ + && dnf install \ hostname \ mariadb \ pdns \ - pdns-backend-mysql \ + && dnf --setopt 'tsflags=' install pdns-backend-mysql \ && dnf clean all RUN arch=$([ "$(arch)" = 'aarch64' ] && echo -n 'arm64' || echo -n 'x86_64') \ @@ -13,6 +15,8 @@ RUN arch=$([ "$(arch)" = 'aarch64' ] && echo -n 'arm64' || echo -n 'x86_64') \ | tar -xzf - -C /usr/local/bin subvars \ && chmod +x /usr/local/bin/subvars +COPY pdns.conf.tpl docker-entrypoint.sh / + ENV VERSION=4.8 \ PDNS_guardian=yes \ PDNS_setuid=pdns \ @@ -21,9 +25,6 @@ ENV VERSION=4.8 \ EXPOSE 53 53/udp -COPY pdns.conf.tpl / -COPY docker-entrypoint.sh / - ENTRYPOINT [ "/docker-entrypoint.sh" ] CMD [ "/usr/sbin/pdns_server" ] diff --git a/pdns/Dockerfile.alpine b/pdns/Dockerfile.alpine index 4766497..1a38e23 100644 --- a/pdns/Dockerfile.alpine +++ b/pdns/Dockerfile.alpine @@ -1,16 +1,21 @@ FROM alpine:3.19.0 -RUN apk add --no-cache \ +RUN apk update \ + && apk upgrade \ + && apk add \ mariadb-client \ pdns \ pdns-backend-mysql \ - pdns-doc + pdns-doc \ + && rm -rf /var/cache/apk/* 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 +COPY pdns.conf.tpl docker-entrypoint.sh / + ENV VERSION=4.8 \ PDNS_guardian=yes \ PDNS_setuid=pdns \ @@ -19,9 +24,6 @@ ENV VERSION=4.8 \ EXPOSE 53 53/udp -COPY pdns.conf.tpl / -COPY docker-entrypoint.sh / - ENTRYPOINT [ "/docker-entrypoint.sh" ] CMD [ "/usr/sbin/pdns_server" ]