From 0130dd70ddc5d42793de802f3a994126f53e2e05 Mon Sep 17 00:00:00 2001 From: z0rayy Date: Wed, 10 Jun 2026 17:49:34 +0700 Subject: [PATCH] Fix Docker PHP-FPM config for Coolify --- Dockerfile | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index cfecd5a..7cde699 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,9 +12,12 @@ RUN apk add --no-cache nginx \ # CRITICAL: Allow ENV vars from Coolify (DB_HOST, DB_PASS, etc.) # to be readable via getenv() in PHP. PHP-FPM strips env vars by default. -RUN echo "" >> /usr/local/etc/php-fpm.d/www.conf \ - && echo "[www]" >> /usr/local/etc/php-fpm.d/www.conf \ - && echo "clear_env = no" >> /usr/local/etc/php-fpm.d/www.conf +RUN set -eux; \ + if grep -qE '^[;[:space:]]*clear_env[[:space:]]*=' /usr/local/etc/php-fpm.d/www.conf; then \ + sed -i 's/^[;[:space:]]*clear_env[[:space:]]*=.*/clear_env = no/' /usr/local/etc/php-fpm.d/www.conf; \ + else \ + printf '\nclear_env = no\n' >> /usr/local/etc/php-fpm.d/www.conf; \ + fi # Copy Nginx configuration COPY nginx.conf /etc/nginx/nginx.conf @@ -23,9 +26,11 @@ COPY nginx.conf /etc/nginx/nginx.conf RUN mkdir -p /run/nginx && \ mkdir -p /var/log/nginx -# Copy entrypoint script and make executable +# Copy entrypoint script +# Fix Windows CRLF line endings (caused by git autocrlf) then make executable COPY entrypoint.sh /entrypoint.sh -RUN chmod +x /entrypoint.sh +RUN sed -i 's/\r$//' /entrypoint.sh \ + && chmod +x /entrypoint.sh # Set working directory WORKDIR /var/www/html