services: php: restart: unless-stopped build: context: . dockerfile: Dockerfile # Overrides Dockerfile HEALTHCHECK: lightweight app route (see HealthController), not / (magazine + relays). # `docker compose up --wait` requires this to pass. healthcheck: test: ["CMD", "curl", "-fsS", "http://127.0.0.1/health", "-o", "/dev/null"] interval: 10s timeout: 5s retries: 6 start_period: 120s environment: APP_ENV: ${APP_ENV:-dev} # Caddy site address: :80 accepts any Host (needed when the app is reached via localhost:HTTP_PORT). SERVER_NAME: ${SERVER_NAME:-:80} # Defaults match .env.dist so a first boot without a .env file creates the same DB user as copying .env.dist later. DATABASE_URL: mysql://${MYSQL_USER:-unfold_user}:${MYSQL_PASSWORD:-password}@database:3306/${MYSQL_DATABASE:-unfold_db}?serverVersion=${MYSQL_VERSION:-8.0}&charset=${MYSQL_CHARSET:-utf8mb4} volumes: - caddy_data:/data - caddy_config:/config # Host port publishing: see compose.override.yaml (dev) and compose.prod.yaml (prod). ###> doctrine/doctrine-bundle ### # --- # The database service below is optional. If you use your own database (container or external), # you can comment out or remove this block. Make sure to update the DATABASE_URL in the php service accordingly. # --- database: image: mysql:${MYSQL_VERSION:-8.0} environment: MYSQL_DATABASE: ${MYSQL_DATABASE:-unfold_db} MYSQL_USER: ${MYSQL_USER:-unfold_user} MYSQL_PASSWORD: ${MYSQL_PASSWORD:-password} MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-root_password} healthcheck: test: ["CMD", "mysqladmin", "ping", "-h", "localhost"] timeout: 5s retries: 5 start_period: 60s volumes: - database_data:/var/lib/mysql:rw # You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data! # - ./docker/db/data:/var/lib/mysql:rw ###< doctrine/doctrine-bundle ### cron: build: context: ./docker/cron volumes: - .:/var/www/html environment: # Passed through from the host .env (Compose substitution); crond jobs read /run/cron-prewarm.env at runtime. PREWARM_FLAGS: ${PREWARM_FLAGS:-} depends_on: database: condition: service_healthy volumes: caddy_data: caddy_config: ###> doctrine/doctrine-bundle ### database_data: ###< doctrine/doctrine-bundle ###