Fix Docker PHP-FPM config for Coolify
This commit is contained in:
+10
-5
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user