Dockerize: Add Dockerfile, nginx.conf, supervisord.conf with clear_env=no fix

This commit is contained in:
z0rayy
2026-06-10 17:11:13 +07:00
parent 40711a766e
commit 7e956cc02e
5 changed files with 120 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
# =========================================================
# Dockerfile - WebGIS PHP Application
# Uses Nginx + PHP-FPM in a single Alpine-based container
# =========================================================
FROM php:8.2-fpm-alpine
# Install system dependencies and PHP extensions
RUN apk add --no-cache \
nginx \
supervisor \
&& docker-php-ext-install mysqli pdo pdo_mysql \
&& docker-php-ext-enable mysqli pdo_mysql
# Copy Nginx configuration
COPY nginx.conf /etc/nginx/nginx.conf
# Copy supervisor configuration (runs Nginx + PHP-FPM together)
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# CRITICAL: Allow ENV vars (DB_HOST, DB_PASS etc) from Coolify to be
# readable by PHP's getenv(). By default PHP-FPM clears all env vars.
RUN echo "[www]" >> /usr/local/etc/php-fpm.d/www.conf && \
echo "clear_env = no" >> /usr/local/etc/php-fpm.d/www.conf
# Set working directory
WORKDIR /var/www/html
# Copy all application files
COPY . .
# Set correct permissions for web files
RUN chown -R www-data:www-data /var/www/html \
&& chmod -R 755 /var/www/html
# Expose port 80
EXPOSE 80
# Start supervisor (which manages both Nginx and PHP-FPM)
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]