mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-01 18:11:20 +08:00
根據 @xqliu 建議,將 healthcheck 改用 curl 代替 wget。 Changes: - Backend healthcheck: wget → curl -f - Frontend healthcheck: wget → curl -f - 保留 frontend 使用 127.0.0.1(避免 DNS 解析問題) Benefits: - curl 在大多數 Docker 基礎鏡像中都有預裝 - wget 在某些發行版可能缺失 - curl -f 會在 HTTP 錯誤時返回非零退出碼 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
56 lines
1.6 KiB
YAML
56 lines
1.6 KiB
YAML
services:
|
||
# Backend service (API and core logic)
|
||
nofx:
|
||
build:
|
||
context: .
|
||
dockerfile: ./docker/Dockerfile.backend
|
||
container_name: nofx-trading
|
||
restart: unless-stopped
|
||
stop_grace_period: 30s # 允许应用有 30 秒时间优雅关闭
|
||
ports:
|
||
- "${NOFX_BACKEND_PORT:-8080}:8080"
|
||
volumes:
|
||
- ./config.json:/app/config.json:ro
|
||
- ./config.db:/app/config.db
|
||
- ./beta_codes.txt:/app/beta_codes.txt:ro
|
||
- ./decision_logs:/app/decision_logs
|
||
- ./prompts:/app/prompts
|
||
- ./secrets:/app/secrets:ro # RSA密钥文件
|
||
- /etc/localtime:/etc/localtime:ro # Sync host time
|
||
environment:
|
||
- TZ=${NOFX_TIMEZONE:-Asia/Shanghai} # Set timezone
|
||
- AI_MAX_TOKENS=4000 # AI响应的最大token数(默认2000,建议4000-8000)
|
||
- DATA_ENCRYPTION_KEY=${DATA_ENCRYPTION_KEY} # 数据库加密密钥
|
||
- JWT_SECRET=${JWT_SECRET} # JWT认证密钥
|
||
networks:
|
||
- nofx-network
|
||
healthcheck:
|
||
test: ["CMD", "curl", "-f", "http://localhost:8080/api/health"]
|
||
interval: 30s
|
||
timeout: 10s
|
||
retries: 3
|
||
start_period: 60s
|
||
|
||
# Frontend service (static serving and proxy)
|
||
nofx-frontend:
|
||
build:
|
||
context: .
|
||
dockerfile: ./docker/Dockerfile.frontend
|
||
container_name: nofx-frontend
|
||
restart: unless-stopped
|
||
ports:
|
||
- "${NOFX_FRONTEND_PORT:-3000}:80"
|
||
networks:
|
||
- nofx-network
|
||
depends_on:
|
||
- nofx
|
||
healthcheck:
|
||
test: ["CMD", "curl", "-f", "http://127.0.0.1/health"]
|
||
interval: 30s
|
||
timeout: 10s
|
||
retries: 3
|
||
start_period: 5s
|
||
|
||
networks:
|
||
nofx-network:
|
||
driver: bridge |