trading.ai/docker-compose.yml
2025-09-23 16:12:18 +08:00

73 lines
2.0 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

services:
# 交易系统Web应用 (MySQL版)
trading-web:
build: .
container_name: trading-ai-web-mysql
ports:
- "8080:8080"
volumes:
# 配置文件
- ./config:/app/config
# 日志文件
- ./logs:/app/logs
environment:
- FLASK_ENV=production
- PYTHONPATH=/app
# MySQL连接配置 (可通过环境变量覆盖)
- MYSQL_HOST=${MYSQL_HOST:-cd-cynosdbmysql-grp-7kdd8qe4.sql.tencentcdb.com}
- MYSQL_PORT=${MYSQL_PORT:-26558}
- MYSQL_USER=${MYSQL_USER:-root}
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-gUjjmQpu6c7V0hMF}
- MYSQL_DATABASE=${MYSQL_DATABASE:-tradingai}
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/api/stats"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# 数据采集服务(可选)
trading-collector:
build: .
container_name: trading-ai-collector-mysql
volumes:
- ./config:/app/config
- ./logs:/app/logs
environment:
- PYTHONPATH=/app
# MySQL连接配置
- MYSQL_HOST=${MYSQL_HOST:-cd-cynosdbmysql-grp-7kdd8qe4.sql.tencentcdb.com}
- MYSQL_PORT=${MYSQL_PORT:-26558}
- MYSQL_USER=${MYSQL_USER:-root}
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-gUjjmQpu6c7V0hMF}
- MYSQL_DATABASE=${MYSQL_DATABASE:-tradingai}
# 运行数据采集脚本
command: ["python", "main.py", "scanmarket"]
restart: unless-stopped
depends_on:
- trading-web
# # Nginx反向代理可选
# nginx:
# image: nginx:alpine
# container_name: trading-ai-nginx
# ports:
# - "80:80"
# - "443:443"
# volumes:
# - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
# - ./nginx/ssl:/etc/nginx/ssl:ro
# depends_on:
# - trading-web
# restart: unless-stopped
# networks:
# - trading-network
# networks:
# trading-network:
# driver: bridge
# volumes:
# trading-data:
# driver: local