1.9 KiB
1.9 KiB
Docker Setup
This app can run fully in Docker using docker compose with PHP-FPM, Nginx and MySQL.
Services
- php: PHP 8.5.1 FPM with required extensions and Composer
- nginx: Serves the Symfony app from public/ and proxies PHP to php-fpm
- database: MySQL 8.0 (data persisted in a volume)
- mailer (dev only via compose.override.yaml): Mailpit (SMTP/UI)
Prerequisites
- Docker and Docker Compose (v2)
Usage
1) Build and start
./docker/setup.sh
App will be served at http://localhost:8080
Alternatively (manual):
docker compose -f docker/compose.yaml -f docker/compose.override.yaml up -d --build
2) Install dependencies
The setup script already runs composer install. To run manually:
docker compose -f docker/compose.yaml -f docker/compose.override.yaml exec php composer install
3) Prepare DB
The setup script already prepares the DB. To run manually:
docker compose -f docker/compose.yaml -f docker/compose.override.yaml exec php php bin/console doctrine:database:create --if-not-exists
docker compose -f docker/compose.yaml -f docker/compose.override.yaml exec php php bin/console doctrine:migrations:migrate -n
4) Run tests
docker compose -f docker/compose.yaml -f docker/compose.override.yaml exec php vendor/bin/phpunit
5) Logs
docker compose -f docker/compose.yaml -f docker/compose.override.yaml logs -f nginx
docker compose -f docker/compose.yaml -f docker/compose.override.yaml logs -f php
6) Stop
docker compose -f docker/compose.yaml -f docker/compose.override.yaml down
Notes
- .env already points DATABASE_URL to the
databaseservice hostname. - Nginx listens on port 8080 (mapped from container 80) to avoid conflicts.
- Source is bind-mounted; changes on host reflect inside containers.
- For production images, create a separate Dockerfile with build steps (composer install --no-dev, cache warmup) and avoid bind mounts.