version: '3.8'

services:
  web:
    build:
      context: .
      dockerfile: docker/php/Dockerfile
    container_name: web-panahan
    ports:
      - "8000:80"
    volumes:
      - ./:/var/www/html
    depends_on:
      - db
    networks:
      - app-network

  db:
    image: mysql:8.0
    container_name: db-panahan
    environment:
      MYSQL_DATABASE: panahan_turnament_new
      MYSQL_ROOT_PASSWORD: root
    ports:
      - "3306:3306"
    volumes:
      - db_data:/var/lib/mysql
      - ./docker/mysql/init.db:/docker-entrypoint-initdb.d
    networks:
      - app-network

  phpmyadmin:
    image: phpmyadmin:latest
    container_name: phpmyadmin-panahan
    environment:
      - PMA_ARBITRARY=1
      - PMA_HOST=db
    ports:
      - "8082:80"
    networks:
      - app-network
    depends_on:
      - db

networks:
  app-network:
    driver: bridge

volumes:
  db_data:
