Architecture overview
The Docker Compose setup includes five services:- app - PHP-FPM application server (Laravel backend)
- web - Nginx web server (reverse proxy)
- worker - Queue worker for background jobs
- db - PostgreSQL database
- frontend - React frontend (served by Nginx)
filebright_net).
Prerequisites
Install Docker
Install Docker Engine 20.10+ and Docker Compose v2.0+ on your system. Visit docker.com for installation instructions.
Service configuration
App service (PHP-FPM)
The main application server runs PHP 8.4-FPM in Alpine Linux for minimal footprint.docker-compose.yml
The app service uses a multi-stage build to optimize image size and includes MongoDB support via PECL extension.
- Multi-stage build process for optimized image size
- Composer dependencies installed with
--no-dev --optimize-autoloader - Automatic migration execution on container start
- Health check dependency ensures database is ready
Web service (Nginx)
Nginx serves as a reverse proxy to the PHP-FPM application server.docker-compose.yml
- Host port
8000maps to container port80 - Backend API accessible at
http://localhost:8000
- Maximum upload size: 100MB (
client_max_body_size 100M) - FastCGI connection to
app:9000 - Static file serving from
/var/www/public
Worker service
Processes queued jobs in the background (emails, file processing, etc.).docker-compose.yml
The worker service uses the same Docker image as the app service but runs
php artisan queue:work instead of PHP-FPM.Database service (PostgreSQL)
PostgreSQL Alpine provides the relational database.docker-compose.yml
- Named volume
filebright_db_datapersists database data - Survives container restarts and rebuilds
- Uses
pg_isreadyto verify database availability - App service waits for healthy status before starting
Frontend service
Serves the React frontend built with Vite.docker-compose.yml
- Stage 1: Node 22 Alpine builds the application (
npm run build) - Stage 2: Nginx Alpine serves static files from
/usr/share/nginx/html
- Host port
80maps to container port80 - Frontend accessible at
http://localhost
Starting the application
Build images
Build all Docker images:This builds the
app, worker, and frontend services from their respective Dockerfiles.Start services
Start all services in detached mode:Docker Compose will:
- Create the
filebright_netnetwork - Create the
filebright_db_datavolume - Start the database and wait for health check
- Start app, worker, web, and frontend services
Verify deployment
Check that all services are running:Expected output shows all five services with “Up” status.
Managing the application
Stop services
Restart services
Stop and remove containers
Remove volumes
To completely remove all data including the database:Running artisan commands
Execute Laravel artisan commands in the app container:Volume management
Storage volume
The./backend/storage directory is mounted to both app and worker services:
- Uploaded files
- Application logs
- Cache files
- Session data
The entrypoint script automatically sets correct permissions (
www-data:www-data) on container start.Database volume
PostgreSQL data persists in the named volumefilebright_db_data:
Custom PHP configuration
Customize PHP settings by editingbackend/php.ini:
backend/php.ini
Network configuration
All services communicate through thefilebright_net bridge network:
app:9000- PHP-FPM applicationdb:5432- PostgreSQL databasefrontend:80- React frontend
Troubleshooting
Container won’t start
Check container logs for errors:- Missing or invalid
.envfile - Database connection failure
- Port conflicts (8000, 80, 5432 already in use)
Database connection errors
Verify database health:.env and docker-compose.yml.
Permission errors
The entrypoint script should handle permissions automatically. If issues persist:Queue jobs not processing
Check worker service status and logs:Next steps
Production deployment
Configure Filebright for production environments
Configuration
Learn about environment variables and settings