services:
  # ════════════════════════════════════════
  #   BACKEND - Node.js / Express
  # ════════════════════════════════════════
  server:
    build:
      context: ./server
      dockerfile: Dockerfile
    container_name: bannickgame-backend
    restart: unless-stopped
    volumes:
      - ./server/src/uploads:/app/src/uploads
    environment:
      - NODE_ENV=production
    networks:
      - app-network

  # ════════════════════════════════════════
  #   FRONTEND - React + Vite
  # ════════════════════════════════════════
  client:
    build:
      context: ./client
      dockerfile: Dockerfile
      args:
        # Đổi thành domain thật của bạn
        VITE_API_URL: /
        VITE_API_URL_IMAGE: /
        VITE_SECRET_CRYPTO: "5577df9df9e506da3350df8040ebc7d33297d820dccc30f102165d6d2a927ee6"
        VITE_CLIENT_ID: "960636708714-m84m8ui6srfp05ubihta9ii6pi6n2f9i.apps.googleusercontent.com"
    container_name: bannickgame-frontend
    restart: unless-stopped
    depends_on:
      - server
    networks:
      - app-network

  # ════════════════════════════════════════
  #   NGINX REVERSE PROXY
  # ════════════════════════════════════════
  nginx:
    image: nginx:alpine
    container_name: bannickgame-nginx
    restart: unless-stopped
    ports:
      - "80:80"
    volumes:
      - ./nginx/default.conf:/etc/nginx/conf.d/default.conf
      - nginx-logs:/var/log/nginx
    depends_on:
      - client
      - server
    networks:
      - app-network

networks:
  app-network:
    driver: bridge
    name: bannickgame-network

volumes:
  nginx-logs:
    name: bannickgame-nginx-logs
