Files
nofx/docker-compose.yml
T
d0lwl0b 0c599ba70b chore: add environment variable support and enhance startup script
- Add .env.example template for configurable Docker deployment settings
- Update docker-compose.yml to support environment-driven port/timezone configuration
- Refactor start.sh with improved Docker Compose detection, environment validation, and automated frontend building
- Enhance script documentation and error handling for better maintainability
2025-10-29 22:35:01 +08:00

46 lines
1.1 KiB
YAML

version: '3.8'
services:
# NOFX Trading Backend
nofx:
build:
context: .
dockerfile: Dockerfile
container_name: nofx-trading
restart: unless-stopped
ports:
- "${NOFX_BACKEND_PORT:-8080}:8080"
volumes:
- ./config.json:/app/config.json:ro
- ./decision_logs:/app/decision_logs
- /etc/localtime:/etc/localtime:ro # 同步主机时间
environment:
- TZ=${NOFX_TIMEZONE:-Asia/Shanghai} # 使用中国时区
networks:
- nofx-network
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
# Frontend (Nginx)
nofx-frontend:
image: nginx:alpine
container_name: nofx-frontend
restart: unless-stopped
ports:
- "${NOFX_FRONTEND_PORT:-3000}:80"
volumes:
- ./web/dist:/usr/share/nginx/html:ro
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
networks:
- nofx-network
depends_on:
- nofx
networks:
nofx-network:
driver: bridge