version: '3.8'

services:
  # Base de données MySQL
  mysql:
    image: mysql:8.0
    container_name: crm-mysql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: crmgaujlocal
      MYSQL_USER: crmgaujlocal
      MYSQL_PASSWORD: local123
    ports:
      - "9307:3306"
    volumes:
      - mysql_data:/var/lib/mysql
      - ./crmgaujprod.sql:/docker-entrypoint-initdb.d/init.sql
    networks:
      - crm-network

  # Serveur Web PHP
  php-apache:
    build:
      context: .
      dockerfile: Dockerfile.local
    container_name: crm-web
    restart: always
    ports:
      - "9090:80"
    volumes:
      - ./www:/var/www/html
    depends_on:
      - mysql
    networks:
      - crm-network

  # phpMyAdmin
  phpmyadmin:
    image: phpmyadmin:latest
    container_name: crm-phpmyadmin
    restart: always
    ports:
      - "9091:80"
    environment:
      PMA_HOST: mysql
      PMA_PORT: 3306
      PMA_USER: root
      PMA_PASSWORD: root
      UPLOAD_LIMIT: 300M
    depends_on:
      - mysql
    networks:
      - crm-network

volumes:
  mysql_data:

networks:
  crm-network:
    driver: bridge

