services:
  # PHP 8.4 with Apache
  web:
    build: .
    container_name: cotedopale_web
    ports:
      - "8080:80"
    volumes:
      - .:/var/www/html
    environment:
      - APACHE_DOCUMENT_ROOT=/var/www/html
      - DOCKER_ENV=development
    depends_on:
      - db
    networks:
      - cotedopale_network

  # MySQL 5.7 (compatible with existing database)
  db:
    image: mysql:5.7
    container_name: cotedopale_db
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: root_password_dev
      MYSQL_DATABASE: proamcottyapp
      MYSQL_USER: proamcottyapp
      MYSQL_PASSWORD: dev_password
    ports:
      - "3306:3306"
    volumes:
      - db_data:/var/lib/mysql
      - ./proamcottyapp.sql:/docker-entrypoint-initdb.d/init.sql
    networks:
      - cotedopale_network

  # phpMyAdmin for database management
  phpmyadmin:
    image: phpmyadmin:latest
    container_name: cotedopale_phpmyadmin
    restart: always
    ports:
      - "8081:80"
    environment:
      PMA_HOST: db
      PMA_USER: root
      PMA_PASSWORD: root_password_dev
    depends_on:
      - db
    networks:
      - cotedopale_network

volumes:
  db_data:

networks:
  cotedopale_network:
    driver: bridge
