version: '3.8'

services:
  # Application Laravel
  app:
    build: .
    container_name: centre-sante-app
    ports:
      - "8080:80"
    volumes:
      - ./storage:/var/www/html/storage
      - ./database:/var/www/html/database
    environment:
      - APP_ENV=production
      - APP_DEBUG=false
    depends_on:
      - db
    networks:
      - centre-sante-network

  # Base de données MySQL (optionnelle)
  db:
    image: mysql:8.0
    container_name: centre-sante-db
    restart: unless-stopped
    environment:
      MYSQL_DATABASE: centre_sante
      MYSQL_ROOT_PASSWORD: secret
      MYSQL_PASSWORD: secret
      MYSQL_USER: laravel
    volumes:
      - db_data:/var/lib/mysql
    ports:
      - "3307:3306"
    networks:
      - centre-sante-network

  # PHPMyAdmin pour la gestion de la base de données
  phpmyadmin:
    image: phpmyadmin:latest
    container_name: centre-sante-phpmyadmin
    environment:
      PMA_HOST: db
      PMA_PORT: 3306
      PMA_USER: root
      PMA_PASSWORD: secret
    ports:
      - "8081:80"
    depends_on:
      - db
    networks:
      - centre-sante-network

volumes:
  db_data:
    driver: local

networks:
  centre-sante-network:
    driver: bridge