services:
  buffer-platform:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: futures-buffer-platform
    restart: unless-stopped
    ports:
      - "9600:8600"
    environment:
      - BUFFER_DB_PATH=/app/data/buffer.db
      - BUFFER_HOST=0.0.0.0
      - BUFFER_PORT=8600
      - CACHE_TTL=300
      - BUFFER_LOG_LEVEL=INFO
      - MAX_WORKERS=2
      - TZ=Asia/Shanghai
    volumes:
      # 数据持久化 - SQLite数据库
      - ./data:/app/data
      # 静态文件（开发模式，生产环境应该打包到镜像中）
      - ./app/static:/app/app/static
      # 日志持久化（可选）
      - ./logs:/app/logs
    healthcheck:
      test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8600/api/v1/health')"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 10s
    networks:
      - futures-network

networks:
  futures-network:
    driver: bridge
