services:
  php:
    image: php:8.2-apache
    container_name: php82
    ports: 
      - 8000:80
    volumes:
      - ./php:/var/www/html
    build: 
      context: .
      dockerfile: Dockerfile  # Correction du nom de DockerFile
    depends_on:
      - db  # Assure que la base de données démarre avant le service PHP
  
  db:
    image: mysql:8.0
    container_name: mysql8
    command: --default-authentication-plugin=mysql_native_password
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: rando
      MYSQL_USER: root
      MYSQL_PASSWORD: password
    ports:
      - 3307:3306
    volumes:
      - mysql-data:/var/lib/mysql  # Ajout d'un volume persistant pour les données de MySQL

  phpma:
    image: arm64v8/phpmyadmin
    container_name: phpmyadmin
    environment:
      PMA_ARBITRARY: 1
      PMA_HOST: db
      PMA_USER: root
      PMA_PASSWORD: pass
      UPLOAD_LIMIT: 20M
    ports:
      - 8899:80
    depends_on:
      - db  # Assure que la base de données est disponible avant phpMyAdmin


volumes:
  mysql-data:
