6d786fbf41
ProcessPoolExecutor(spawn)子进程不继承主进程 sys.path(insert 是内存修改), import sanguo_orchestrator 失败->BrokenProcessPool->API 回测静默失败,POST 秒回 task_id 但轮询永远 404。spawn 继承 env 不继承 sys.path,故: 1. Dockerfile ENV PYTHONPATH=/app:/app/vnpy_v4.4.0(镜像层,bind mount 覆盖不了) 2. entrypoint.sh 回仓库根(git mv 自 docker/):promote --exclude /docker 致旧版 entrypoint 在 NAS 成 git 外孤儿(340行,被 bind mount 覆盖镜像层);回根后全量 rsync 自动推可复现(对齐 docs/deployment/nas-deploy-plan.md 预设修复)+export 兜底 3. 三 Dockerfile COPY 路径同步 反馈: 策略 session(根因诊断+探针验证)
44 lines
1.1 KiB
Docker
44 lines
1.1 KiB
Docker
# Sanguo VeighNa Docker 镜像 - 本地构建版
|
|
# 使用国内 PyPI 镜像源,跳过 apt-get 和 TA-Lib 编译
|
|
|
|
FROM python:3.10-slim
|
|
|
|
# 设置环境变量
|
|
ENV TZ=Asia/Shanghai \
|
|
DEBIAN_FRONTEND=noninteractive \
|
|
PYTHONUNBUFFERED=1 \
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
VNPY_LOG_LEVEL=INFO \
|
|
TA_LIBRARY_PATH=/usr/local/lib \
|
|
TA_INCLUDE_PATH=/usr/local/include \
|
|
PIP_DEFAULT_TIMEOUT=300 \
|
|
# 使用清华 PyPI 镜像
|
|
PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple \
|
|
PIP_TRUSTED_HOST=pypi.tuna.tsinghua.edu.cn
|
|
|
|
# 设置工作目录
|
|
WORKDIR /app
|
|
|
|
# 创建数据目录
|
|
RUN mkdir -p /app/data /app/logs /app/config /app/temp
|
|
|
|
# 复制 requirements 并安装依赖
|
|
COPY requirements-docker.txt .
|
|
RUN pip install --no-cache-dir --upgrade pip && \
|
|
pip install --no-cache-dir -r requirements-docker.txt
|
|
|
|
# 复制应用代码
|
|
COPY sanguo_web/ /app/sanguo_web/
|
|
COPY vnpy_v4.4.0/vnpy/ /app/vnpy/
|
|
COPY run_web.py /app/
|
|
|
|
# 复制启动脚本
|
|
COPY entrypoint.sh /app/
|
|
RUN chmod +x /app/entrypoint.sh
|
|
|
|
# 暴露端口
|
|
EXPOSE 8000 8080
|
|
|
|
# 启动命令
|
|
ENTRYPOINT ["/app/entrypoint.sh"]
|