# ========================================================= # 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"]