deploy: STORY_WEB_RELOAD=1 可选热重载 + gitsync整仓库挂/app——后端改动也push即生效,仅改依赖/环境变量需重建镜像

This commit is contained in:
2026-06-10 17:44:24 +08:00
parent 90402c4a17
commit 81f62db9f3
2 changed files with 14 additions and 5 deletions

View File

@ -31,4 +31,7 @@ WORKDIR /app/web
HEALTHCHECK --interval=30s --timeout=4s --start-period=8s --retries=3 \
CMD python -c "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:8787/',timeout=3).status==200 else 1)"
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8787"]
# STORY_WEB_RELOAD=1 时启用代码热重载(配合把 git 同步仓库整目录挂到 /app
# 后端 app.py/db.py/ir_core 改动 push 后自动生效,无需重建镜像;仅改依赖/环境变量仍需重建)。
# 无该变量时与原行为一致(生产默认不开监视)。
CMD ["sh", "-c", "exec uvicorn app:app --host 0.0.0.0 --port 8787 ${STORY_WEB_RELOAD:+--reload --reload-dir /app}"]