70 lines
1.4 KiB
YAML
70 lines
1.4 KiB
YAML
version: '3.8'
|
||
|
||
services:
|
||
# 交易系统Web应用
|
||
trading-web:
|
||
build: .
|
||
container_name: trading-ai-web
|
||
ports:
|
||
- "8080:8080"
|
||
volumes:
|
||
# 数据持久化
|
||
- ./data:/app/data
|
||
# 配置文件
|
||
- ./config:/app/config
|
||
# 日志文件
|
||
- ./logs:/app/logs
|
||
environment:
|
||
- FLASK_ENV=production
|
||
- PYTHONPATH=/app
|
||
restart: unless-stopped
|
||
healthcheck:
|
||
test: ["CMD", "curl", "-f", "http://localhost:8080/api/stats"]
|
||
interval: 30s
|
||
timeout: 10s
|
||
retries: 3
|
||
start_period: 40s
|
||
networks:
|
||
- trading-network
|
||
|
||
# 数据采集服务(可选)
|
||
trading-collector:
|
||
build: .
|
||
container_name: trading-ai-collector
|
||
volumes:
|
||
- ./data:/app/data
|
||
- ./config:/app/config
|
||
- ./logs:/app/logs
|
||
environment:
|
||
- PYTHONPATH=/app
|
||
# 运行数据采集脚本
|
||
command: python scripts/data_collector.py
|
||
restart: unless-stopped
|
||
depends_on:
|
||
- trading-web
|
||
networks:
|
||
- trading-network
|
||
|
||
# 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 |