Overview
The CFB Marble Game uses a sophisticated multi-stage Docker build that combines nginx and PHP-FPM in a single container, managed by s6-overlay. This architecture provides optimal performance for production deployments.Dockerfile Architecture
The Dockerfile uses a multi-stage build with three primary stages:Stage 1: Tailwind CSS Build
- Uses Node.js 22 Alpine for minimal image size
- Installs npm dependencies
- Builds production CSS assets with Tailwind
- Outputs compiled assets to
/build/dist/
Stage 2: Production Image
PHP Extensions
Installed PHP extensions for application functionality:- GD - Image manipulation (with freetype and jpeg support)
- Xdebug 3.4.0 - Development debugging (disabled by default)
- intl - Internationalization
- zip - Archive handling
- bcmath - Arbitrary precision mathematics
- opcache - PHP bytecode caching
- pcntl - Process control
- pdo_mysql - Database connectivity
- sockets - Socket communication
- sysvsem - System V semaphores
Process Management with s6-overlay
The image uses s6-overlay v3.2.0.2 as an init system and process supervisor:nginx Installation
Nginx is installed from official repositories:Composer Dependencies
nginx Configuration
Server Block
The nginx configuration (docker/app/nginx/default.conf) handles PHP routing:
- Clean URLs without
index.php - Trailing slash removal
- PHP-FPM communication on
127.0.0.1:9000 - Security headers (Permissions-Policy)
PHP-FPM Configuration
The PHP-FPM pool configuration (docker/app/php/php-fpm.conf):
- Process Manager: Static mode with 4 workers
- Max Requests: Workers restart after 1000 requests
- Slow Log: Disabled (set to 0)
Development Images
The Dockerfile includes specialized development stages:PHP_CodeSniffer Image
PHPUnit Image
Building the Image
Local Development
docker-compose.yml:
Production Build
Xdebug Management
Xdebug is installed but disabled by default. Helper scripts are provided:Container Startup
The container uses s6-overlay as the entrypoint:/etc/cont-init.d/- Initialization scripts/etc/services.d/- Service definitions (nginx, php-fpm)