version: '3.8'

services:
  app:
    build:
      context: .
      dockerfile: docker/php/Dockerfile
    container_name: laravel-app
    restart: unless-stopped
    working_dir: /var/www
    # volumes:
    #   - .:/var/www
    depends_on:
      - mysql
    networks:
      - laravel

  web:
    image: nginx:alpine
    container_name: nginx-web
    ports:
      - "8080:80"
    volumes:
      - .:/var/www
      - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
    depends_on:
      - app
    networks:
      - laravel

  mysql:
    image: mysql:8.2
    container_name: mysql-db
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: laravel
      MYSQL_USER: laravel
      MYSQL_PASSWORD: Romeo@2018
    ports:
      - "3306:3306"
    volumes:
      - mysql_data:/var/lib/mysql
    networks:
      - laravel
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: pma
    restart: always
    ports:
      - "8090:80"                        # Accessible via localhost:8090
    environment:
      PMA_HOST: mysql                   # Nom du service MySQL
      PMA_PORT: 3306
    depends_on:
      - mysql
    networks:
      - laravel

volumes:
  mysql_data:

networks:
  laravel:
    driver: bridge