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:
+6
-3
@@ -19,6 +19,9 @@ services:
|
||||
TZ: Asia/Shanghai
|
||||
|
||||
volumes:
|
||||
# Per-run crawler output, read back by the monitor layer. Without this the
|
||||
# data would live inside the container and vanish on every rebuild.
|
||||
- ./data:/app/data
|
||||
# The code is mounted rather than baked in, so shipping a change is
|
||||
# "re-upload the tarball, restart" instead of an image rebuild. Only the
|
||||
# dependencies live in the image, because those are the expensive part and
|
||||
# they change rarely -- rebuild only when requirements.txt or the
|
||||
# Dockerfile itself changes.
|
||||
- ./:/app
|
||||
|
||||
Reference in New Issue
Block a user