From d876232b5ffda7f4748fa8da11f16ce66ca05c05 Mon Sep 17 00:00:00 2001 From: Tim Bendt Date: Wed, 26 Nov 2025 13:26:30 -0500 Subject: [PATCH] Add Dockerfile and supervisord for PHP deployment --- Dockerfile | 44 ++++++++++++++++++++++++++++++++++++++++++++ nginx.conf | 6 +++--- supervisord.conf | 16 ++++++++++++++++ 3 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 Dockerfile create mode 100644 supervisord.conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b877810 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,44 @@ +FROM php:8.1-fpm + +# Install system dependencies +RUN apt-get update && apt-get install -y \ + git \ + curl \ + libpng-dev \ + libonig-dev \ + libxml2-dev \ + libzip-dev \ + zip \ + unzip \ + nginx \ + supervisor + +# Clear cache +RUN apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install PHP extensions +RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd zip + +# Get latest Composer +COPY --from=composer:latest /usr/bin/composer /usr/bin/composer + +# Set working directory +WORKDIR /var/www/html + +# Copy composer files +COPY composer.json composer.lock ./ + +# Install PHP dependencies +RUN composer install --no-dev --optimize-autoloader + +# Copy application code +COPY . . + +# Copy nginx configuration +COPY nginx.conf /etc/nginx/conf.d/default.conf + +# Expose port +EXPOSE 80 + +# Start supervisor +CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] \ No newline at end of file diff --git a/nginx.conf b/nginx.conf index 2699111..f602912 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,10 +1,10 @@ upstream php { - server unix:/tmp/heroku.fcgi; + server unix:/var/run/php/php8.1-fpm.sock; } server { listen 8080; - root /app; + root /var/www/html; index index.php index.html; # Block access to hidden files and directories @@ -49,7 +49,7 @@ server { # Static assets for pancake/third_party location /pancake/third_party { - alias /app/pancake/third_party; + alias /var/www/html/pancake/third_party; expires 1y; add_header Cache-Control "public, immutable"; diff --git a/supervisord.conf b/supervisord.conf new file mode 100644 index 0000000..b3f76a3 --- /dev/null +++ b/supervisord.conf @@ -0,0 +1,16 @@ +[supervisord] +nodaemon=true + +[program:php-fpm] +command=php-fpm +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:nginx] +command=nginx -g 'daemon off;' +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 \ No newline at end of file