services:
  php:
    build: .
    working_dir: /var/www/html
    volumes:
      - ./:/var/www/html
      - symfony_vendor:/var/www/html/vendor
      - symfony_var:/var/www/html/var
    env_file:
      - .env
      - .env.local
    environment:
      APP_ENV: dev
      APP_DEBUG: "1"
    extra_hosts:
      - "host.docker.internal:host-gateway"

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

  db:
    image: mysql:8.0
    command:
      - --default-authentication-plugin=mysql_native_password
      - --character-set-server=utf8mb4
      - --collation-server=utf8mb4_unicode_ci
    environment:
      MYSQL_DATABASE: caerm
      MYSQL_USER: caerm
      MYSQL_PASSWORD: caerm
      MYSQL_ROOT_PASSWORD: root
    ports:
      - "3307:3306"
    volumes:
      - db_data:/var/lib/mysql

  phpmyadmin:
    image: phpmyadmin:latest
    depends_on:
      - db
    environment:
      PMA_HOST: db
      PMA_PORT: 3306
      PMA_USER: root
      PMA_PASSWORD: root
      UPLOAD_LIMIT: 256M
    ports:
      - "8084:80"

volumes:
  symfony_vendor:
  symfony_var:
  db_data:
