Files
Escapepage/doc/docker.md
2026-01-11 15:25:03 +01:00

1.5 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 up -d --build

2) Install dependencies

The setup script already runs composer install. To run manually:

docker compose exec php composer install

3) Prepare DB

The setup script already prepares the DB. To run manually:

docker compose exec php php bin/console doctrine:database:create --if-not-exists
docker compose exec php php bin/console doctrine:migrations:migrate -n

4) Run tests

docker compose exec php vendor/bin/phpunit

5) Logs

docker compose logs -f nginx
docker compose logs -f php

6) Stop

docker compose down

Notes

  • .env already points DATABASE_URL to the database service 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.