# ========================================================================= # 智能股票分析助手 — Docker Compose 编排文件 # # 启动: docker compose up -d # 停止: docker compose down # 查看日志: docker compose logs -f # ========================================================================= version: '3.8' services: # ========================================================================= # 后端服务 — FastAPI # ========================================================================= backend: build: context: . dockerfile: backend/Dockerfile container_name: stock-analyzer-backend ports: - "8000:8000" volumes: # 持久化 SQLite 数据库 - stock_data:/app/data environment: - PYTHONUNBUFFERED=1 restart: unless-stopped healthcheck: test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/api/v1/system/health')"] interval: 30s timeout: 10s retries: 3 start_period: 10s # ========================================================================= # 前端服务 — Nginx + Vue3 SPA # ========================================================================= frontend: build: context: . dockerfile: frontend/Dockerfile container_name: stock-analyzer-frontend ports: - "8080:80" depends_on: - backend restart: unless-stopped volumes: stock_data: name: stock_analyzer_data