From 0a615b25cac67360804154b058722e570bf276ac Mon Sep 17 00:00:00 2001 From: Peter Schiffer <3899107+pschiffe@users.noreply.github.com> Date: Tue, 19 Dec 2023 20:50:59 +0100 Subject: [PATCH] Allow configuration of uwsgi host and port in static image via env vars `PDNS_ADMIN_STATIC_UWSGI_HOST` and `PDNS_ADMIN_STATIC_UWSGI_PORT` Fixes #27 --- pdns-admin-static-ngoduykhanh/Dockerfile | 4 +++- pdns-admin-static-ngoduykhanh/docker-entrypoint.sh | 7 +++++++ .../{pdns-nginx.conf => pdns-nginx.conf.tpl} | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100755 pdns-admin-static-ngoduykhanh/docker-entrypoint.sh rename pdns-admin-static-ngoduykhanh/{pdns-nginx.conf => pdns-nginx.conf.tpl} (91%) diff --git a/pdns-admin-static-ngoduykhanh/Dockerfile b/pdns-admin-static-ngoduykhanh/Dockerfile index 2c5cd11..ce1a15f 100644 --- a/pdns-admin-static-ngoduykhanh/Dockerfile +++ b/pdns-admin-static-ngoduykhanh/Dockerfile @@ -4,8 +4,10 @@ RUN dnf -y --setopt=install_weak_deps=False install \ nginx \ && dnf clean all +COPY pdns-nginx.conf.tpl docker-entrypoint.sh / + EXPOSE 80 -COPY pdns-nginx.conf /etc/nginx/nginx.conf +ENTRYPOINT [ "/docker-entrypoint.sh" ] CMD [ "/usr/sbin/nginx", "-g", "daemon off;" ] diff --git a/pdns-admin-static-ngoduykhanh/docker-entrypoint.sh b/pdns-admin-static-ngoduykhanh/docker-entrypoint.sh new file mode 100755 index 0000000..c70a7cb --- /dev/null +++ b/pdns-admin-static-ngoduykhanh/docker-entrypoint.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +set -euo pipefail + +subvars --prefix 'PDNS_ADMIN_STATIC_' < /pdns-nginx.conf.tpl > /etc/nginx/nginx.conf + +exec "$@" diff --git a/pdns-admin-static-ngoduykhanh/pdns-nginx.conf b/pdns-admin-static-ngoduykhanh/pdns-nginx.conf.tpl similarity index 91% rename from pdns-admin-static-ngoduykhanh/pdns-nginx.conf rename to pdns-admin-static-ngoduykhanh/pdns-nginx.conf.tpl index 08be5a3..9f82b19 100644 --- a/pdns-admin-static-ngoduykhanh/pdns-nginx.conf +++ b/pdns-admin-static-ngoduykhanh/pdns-nginx.conf.tpl @@ -45,7 +45,7 @@ http { location @pdns_admin { include uwsgi_params; - uwsgi_pass pdns-admin-uwsgi:9494; + uwsgi_pass {{ .PDNS_ADMIN_STATIC_UWSGI_HOST | default "pdns-admin-uwsgi" }}:{{ .PDNS_ADMIN_STATIC_UWSGI_PORT | default 9494 }}; } error_page 404 /404.html;