
services:
  # حاوية PHP (App) - تم تخصيص الأسماء لـ Tamkeen
  app:
    build:
      context: .
      dockerfile: Dockerfile
    image: tamkeen-app-image
    container_name: tamkeen-app
    restart: unless-stopped
    working_dir: /var/www
    volumes:
      - ./src:/var/www
    networks:
      - tamkeen-network

  # حاوية Nginx (Web Server)
  webserver:
    image: nginx:alpine
    container_name: tamkeen-webserver
    restart: unless-stopped
    ports:
      - "8000:80"
    volumes:
      - ./src:/var/www
      - ./nginx.conf:/etc/nginx/conf.d/default.conf
    networks:
      - tamkeen-network

  # حاوية MySQL (Database)
  db:
    image: mysql:8.0
    container_name: tamkeen-db
    restart: unless-stopped
    ports:
      - "3306:3306"
    environment:
      MYSQL_DATABASE: tamkeen_db
      MYSQL_ROOT_PASSWORD: root_password
      MYSQL_USER: tamkeen_user
      MYSQL_PASSWORD: tamkeen_password
    volumes:
      - tamkeen_dbdata:/var/lib/mysql
    networks:
      - tamkeen-network

  # حاوية phpMyAdmin لإدارة قاعدة البيانات
  phpmyadmin:
    image: phpmyadmin:latest
    container_name: tamkeen-phpmyadmin
    restart: unless-stopped
    ports:
      - "8080:80" # سيتم فتح phpMyAdmin عبر البورت 8080
    environment:
      PMA_HOST: db # الربط مع حاوية MySQL عبر اسم الخدمة
      PMA_PORT: 3306
      PMA_ARBITRARY: 1
    networks:
      - tamkeen-network

networks:
  tamkeen-network:
    driver: bridge

volumes:
  tamkeen_dbdata:
    driver: local