version: '3.8'

services:
  # MySQL Database
  db:
    image: mysql:8.0
    restart: unless-stopped
    environment:
      MYSQL_DATABASE: bisku
      MYSQL_ROOT_PASSWORD: root_password
      MYSQL_PASSWORD: bisku_password
      MYSQL_USER: bisku_user
    volumes:
      - db_data:/var/lib/mysql
    # ports:
    #   - "3306:3306"
    networks:
      - bisku_network

  # PHP-FPM Application
  app:
    build:
      context: .
      dockerfile: Dockerfile
    restart: unless-stopped
    working_dir: /var/www/html
    volumes:
      - ./:/var/www/html
    depends_on:
      - db
      # - redis
    networks:
      - bisku_network

  # Nginx Web Server
  nginx:
    image: nginx:alpine
    restart: unless-stopped
    # ports:
    #   - "8000:80"
    volumes:
      - ./:/var/www/html
      - ./nginx:/etc/nginx/conf.d  # Mount a folder containing your default.conf
    depends_on:
      - app
    networks:
      - bisku_network

  # Redis Cache
  # redis:
  #   image: redis:7-alpine
  #   container_name: bisku_redis
  #   restart: unless-stopped
  #   ports:
  #     - "6379:6379"
  #   volumes:
  #     - redis_data:/data
  #   networks:
  #     - bisku_network

  # # PHPMyAdmin (Optional - for database management)
  # phpmyadmin:
  #   image: phpmyadmin/phpmyadmin
  #   container_name: bisku_phpmyadmin
  #   restart: unless-stopped
  #   ports:
  #     - "8080:80"
  #   environment:
  #     PMA_HOST: db
  #     PMA_USER: root
  #     PMA_PASSWORD: root_password
  #   depends_on:
  #     - db
  #   networks:
  #     - bisku_network

volumes:
  db_data:
    driver: local
  # redis_data:
  #   driver: local

networks:
  bisku_network:
    driver: bridge
