services:
  nginx:
    image: nginx:1.27-alpine
    ports:
      - "8082:80"
    volumes:
      - ./:/var/www/html
      - ./.docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
    depends_on:
      - php

  php:
    build: ./.docker/php
    volumes:
      - ./:/var/www/html
    env_file:
      - .env
    depends_on:
      db:
        condition: service_healthy

  db:
    image: mysql:8.0
    env_file:
      - .env
    ports:
      - "3308:3306"
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p$$MYSQL_ROOT_PASSWORD"]
      interval: 5s
      timeout: 5s
      retries: 10
    volumes:
      - dbdata:/var/lib/mysql

volumes:
  dbdata:
