From 68da285e90741835f250ec4b9168973f591a5c02 Mon Sep 17 00:00:00 2001 From: xZero707 Date: Fri, 20 Jan 2023 17:32:48 +0100 Subject: [PATCH] Remove /etc/cont-init.d ties to nlss/php-nginx:7.4 image --- Dockerfile | 3 --- rootfs/etc/cont-init.d/20-nginx-log-stream | 12 ++++++++++++ rootfs/etc/cont-init.d/20-parse-template | 10 ++++++++++ rootfs/etc/cont-init.d/99-webuser-permissions | 4 ++++ 4 files changed, 26 insertions(+), 3 deletions(-) create mode 100755 rootfs/etc/cont-init.d/20-nginx-log-stream create mode 100755 rootfs/etc/cont-init.d/20-parse-template create mode 100755 rootfs/etc/cont-init.d/99-webuser-permissions diff --git a/Dockerfile b/Dockerfile index eb2c01d..7c878a8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,9 +17,6 @@ COPY --from=nlss/attr ["/usr/local/bin/attr", "/usr/local/bin/"] # Add crond service COPY --from=nlss/base-alpine:3.14 ["/etc/services.d/cron/", "/etc/services.d/cron/"] -# Add container init tasks -COPY --from=nlss/php-nginx:7.4 ["/etc/cont-init.d/", "/etc/cont-init.d/"] - # Add php-fpm configuration COPY --from=nlss/php-nginx:7.4 ["/usr/local/etc/php-fpm.d/", "/usr/local/etc/php-fpm.d/"] diff --git a/rootfs/etc/cont-init.d/20-nginx-log-stream b/rootfs/etc/cont-init.d/20-nginx-log-stream new file mode 100755 index 0000000..8b6c1c4 --- /dev/null +++ b/rootfs/etc/cont-init.d/20-nginx-log-stream @@ -0,0 +1,12 @@ +#!/usr/bin/with-contenv sh +set -e + +echo "Redirecting nginx logs to output streams..." + +# General logs +ln -sf /dev/stdout /var/log/nginx/access.log +ln -sf /dev/stderr /var/log/nginx/error.log + +# App specific logs +ln -sf /dev/stdout /var/log/nginx/app-access.log +ln -sf /dev/stderr /var/log/nginx/app-error.log diff --git a/rootfs/etc/cont-init.d/20-parse-template b/rootfs/etc/cont-init.d/20-parse-template new file mode 100755 index 0000000..d269ef1 --- /dev/null +++ b/rootfs/etc/cont-init.d/20-parse-template @@ -0,0 +1,10 @@ +#!/usr/bin/with-contenv sh +set -e + +echo "Parsing virtual host template..." +/usr/local/bin/gomplate -V \ + -o /etc/nginx/sites-available/app.conf \ + -f /etc/templates/tmpl-app-nginx.conf + +echo "Enabling virtual host..." +ln -sf /etc/nginx/sites-available/app.conf /etc/nginx/sites-enabled/app.conf diff --git a/rootfs/etc/cont-init.d/99-webuser-permissions b/rootfs/etc/cont-init.d/99-webuser-permissions new file mode 100755 index 0000000..dff5c18 --- /dev/null +++ b/rootfs/etc/cont-init.d/99-webuser-permissions @@ -0,0 +1,4 @@ +#!/usr/bin/with-contenv sh +set -e + +attr /var/www true www-data:www-data 0770 2771/etc/cont-init.d