# ====== CONFIGURE PORTS MANUALLY ======
# PHP/Apache: 1038 (host) → 80 (container)
# MySQL: 3322 (host) → 3306 (container)
# phpMyAdmin: 8022 (host) → 80 (container)

services:
  php-fpm:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: chaggerdental-php
    volumes:
      - ./web:/var/www/html
      - ./php.ini:/usr/local/etc/php/conf.d/custom.ini
    networks:
      - chaggerdental-network

  nginx:
    image: nginx:latest
    container_name: chaggerdental-nginx
    ports:
      - "1038:80"            # Host:Container (change 1038 if needed)   # Access site at http://localhost:1038
    volumes:
      - ./web:/var/www/html
      - ./nginx.conf:/etc/nginx/conf.d/default.conf
    depends_on:
      - php-fpm
    networks:
      - chaggerdental-network

  mysql:
    image: mysql:8.0
    container_name: chaggerdental-mysql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: rootpass
      MYSQL_DATABASE: chaggerdental_db
      MYSQL_USER: chaggerdental_user
      MYSQL_PASSWORD: chaggerdental_pass
    ports:
      - "3322:3306"          # Host:Container (change 3322 if needed)
    volumes:
      - db_data:/var/lib/mysql
    networks:
      - chaggerdental-network

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: chaggerdental-phpmyadmin
    restart: always
    ports:
      - "8022:80"            # Host:Container (change 8022 if needed)   # Access phpmyadmin at http://localhost:8022
    environment:
      PMA_HOST: mysql
      PMA_USER: chaggerdental_user
      PMA_PASSWORD: chaggerdental_pass
      PMA_PORT: 3306
    depends_on:
      - mysql
    networks:
      - chaggerdental-network

networks:
  chaggerdental-network:

volumes:
  db_data:
