Add Dockerfile and supervisord for PHP deployment

This commit is contained in:
Tim Bendt
2025-11-26 13:26:30 -05:00
parent c520b7df89
commit d876232b5f
3 changed files with 63 additions and 3 deletions

44
Dockerfile Normal file
View File

@@ -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"]

View File

@@ -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";

16
supervisord.conf Normal file
View File

@@ -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