- 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 却看着一切正常
28 lines
953 B
YAML
28 lines
953 B
YAML
services:
|
|
mediacrawler:
|
|
build: .
|
|
image: mediacrawler:latest
|
|
container_name: mediacrawler
|
|
restart: unless-stopped
|
|
|
|
# host networking is a requirement, not a convenience: the crawler attaches
|
|
# to the operator's Chrome at 127.0.0.1:9222, and inside a bridge network
|
|
# that loopback is the container's own, where no browser is listening.
|
|
# It also puts the app port directly on the host, so `ports:` is not used.
|
|
network_mode: host
|
|
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
MC_HOST: 0.0.0.0
|
|
MC_PORT: "18051"
|
|
TZ: Asia/Shanghai
|
|
|
|
volumes:
|
|
# 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
|