refactor: 镜像只装依赖,代码改为挂载
- Dockerfile: 去掉 COPY . .,镜像退化为纯依赖层,改代码不再需要重建镜像 - Dockerfile: 补 libgl1 / libxcb1 / libglib2.0-0 等 X11 库。opencv-python 在导入时需要它们,而 tools/utils.py 会经 slider_util 导入 cv2 —— 缺了不是某个边角功能挂掉,是整个应用起不来(已在真机冒烟中验证) - Dockerfile: 补 tzdata,否则 TZ=Asia/Shanghai 被静默忽略,所有时间戳落成 UTC - Dockerfile: apt 与 pip 均改走国内源。deb.debian.org 实测约 13 kB/s,96 MB 构建依赖要跑半小时以上 - docker-compose: 挂载 ./ 到 /app,部署流程从「重建镜像」变成「重传 + 重启」 - main.py: 启动时若缺 api/webui/index.html 就打印警告,避免只返回一段 JSON 却看着一切正常
This commit is contained in:
+10
@@ -70,6 +70,16 @@ async def lifespan(_app: FastAPI):
|
||||
|
||||
await init_db()
|
||||
|
||||
# The WebUI bundle is gitignored and built separately, so a deployment that
|
||||
# forgot it would otherwise come up looking healthy and serve a bare JSON
|
||||
# stub at "/" -- worth one loud line at boot rather than a puzzled operator.
|
||||
if not os.path.exists(os.path.join(WEBUI_DIR, "index.html")):
|
||||
print(
|
||||
"[综合采集平台] 警告:未找到前端产物 api/webui/index.html,"
|
||||
"根路径只会返回一段 JSON。请先在 webui/ 下执行 npm run build。",
|
||||
flush=True,
|
||||
)
|
||||
|
||||
generated = await ensure_initial_credential()
|
||||
if generated:
|
||||
# Printed once, on the run that creates it. There is no unauthenticated
|
||||
|
||||
Reference in New Issue
Block a user