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
This commit is contained in:
d0lwl0b
2025-10-29 22:35:01 +08:00
parent 998cdc9abf
commit 0c599ba70b
4 changed files with 137 additions and 33 deletions
+3 -3
View File
@@ -9,13 +9,13 @@ services:
container_name: nofx-trading
restart: unless-stopped
ports:
- "8080:8080"
- "${NOFX_BACKEND_PORT:-8080}:8080"
volumes:
- ./config.json:/app/config.json:ro
- ./decision_logs:/app/decision_logs
- /etc/localtime:/etc/localtime:ro # 同步主机时间
environment:
- TZ=Asia/Shanghai # 使用中国时区
- TZ=${NOFX_TIMEZONE:-Asia/Shanghai} # 使用中国时区
networks:
- nofx-network
healthcheck:
@@ -31,7 +31,7 @@ services:
container_name: nofx-frontend
restart: unless-stopped
ports:
- "3000:80"
- "${NOFX_FRONTEND_PORT:-3000}:80"
volumes:
- ./web/dist:/usr/share/nginx/html:ro
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro