services:
  php:
    build:
      context: .                     # racine du projet
      dockerfile: docker/php/Dockerfile
    container_name: jo2024-docker_php
    working_dir: /var/www/symfony
    volumes:
      - ./app:/var/www/symfony
      - ./.env.docker.local:/var/www/symfony/.env.local:ro
    networks:
      - symfony

  web:
    image: nginx:alpine
    container_name: jo2024-docker_nginx
    ports:
      - "8080:80"
    volumes:
      - ./app:/var/www/symfony
      - ./.env.docker.local:/var/www/symfony/.env.local:ro
      - ./docker/nginx/nginx.conf:/etc/nginx/conf.d/default.conf
    networks:
      - symfony
    depends_on:
      - php

  db:
    image: mysql:8.0
    container_name: jo2024-docker_db
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: jo2024
      MYSQL_USER: jo2024
      MYSQL_PASSWORD: jo2024
    ports:
      - "3307:3306"
    volumes:
      - db_data:/var/lib/mysql
    networks:
      - symfony

  phpmyadmin:
    image: phpmyadmin/phpmyadmin:latest
    container_name: jo2024-docker_pma
    environment:
      PMA_HOST: db
      PMA_USER: jo2024
      PMA_PASSWORD: jo2024
    ports:
      - "8081:80"
    depends_on:
      - db
    networks:
      - symfony

  mailhog:
    image: mailhog/mailhog
    container_name: jo2024-docker_mailhog
    ports:
      - "1025:1025"   # port SMTP
      - "8025:8025"   # interface web
    networks:
      - symfony

  redis:
    image: redis:alpine
    container_name: jo2024-docker_redis
    ports:
      - "6379:6379"
    networks:
      - symfony

volumes:
  db_data:

networks:
  symfony:
