# Production — copy to /etc/dwd-stack/docker-compose.yml on the server
#   sudo cp docker-compose.prod.yml /etc/dwd-stack/docker-compose.yml
#
# Requires flat clones under /opt/apis/ (one repo per directory) and env files
# under /etc/<service>/ per service. Creates dwd-stack network on first up.

services:
  dwd-api-fastapi:
    build:
      context: /opt/apis/dwd-api-fastapi
      dockerfile: Dockerfile
      target: slim
    image: dwd-api-fastapi:slim
    ports:
      - "127.0.0.1:8001:8080"
    env_file:
      - /etc/dwd-api-fastapi/dwd-api-fastapi.env
    environment:
      PORT: "8080"
      GUNICORN_WORKERS: "2"
      GUNICORN_TIMEOUT: "120"
      MCP_SERVER_URL: http://dwd-mcp-fastmcp:8081/mcp
    networks:
      - dwd-stack
    restart: unless-stopped

  dwd-mcp-fastmcp:
    build:
      context: /opt/apis/dwd-mcp-fastmcp
      dockerfile: Dockerfile
    image: dwd-mcp-fastmcp:latest
    ports:
      - "127.0.0.1:8002:8081"
    env_file:
      - /etc/dwd-mcp-fastmcp/dwd-mcp-fastmcp.env
    environment:
      PORT: "8081"
      GUNICORN_WORKERS: "2"
      GUNICORN_TIMEOUT: "120"
    networks:
      - dwd-stack
    restart: unless-stopped

  dwd-copilot-server:
    build:
      context: /opt/apis/dwd-copilot-server
      dockerfile: Dockerfile
    image: dwd-copilot-server:latest
    ports:
      - "127.0.0.1:8003:8082"
    env_file:
      - /etc/dwd-copilot-server/dwd-copilot-server.env
    environment:
      PORT: "8082"
      AGUI_AGENT_URL: http://dwd-api-fastapi:8080/agent
    networks:
      - dwd-stack
    restart: unless-stopped

networks:
  dwd-stack:
    name: dwd-stack
    driver: bridge
