Dockerfile 部署

This commit is contained in:
hjq
2026-06-12 17:24:19 +08:00
parent fa076bb13a
commit 200c7cf9ae
4 changed files with 52 additions and 10 deletions

View File

@@ -41,5 +41,6 @@ EXPOSE 5050
# 1. 清理可能因异常重启遗留的虚拟屏幕锁文件(防止 xvfb 报错退出)
# 2. 切换到 web_ui 目录执行 gunicorn
# 3. 使用 xvfb-run -a 自动分配空闲的虚拟屏幕
# 4. 增加 --access-logfile - 参数,让 Gunicorn 输出 HTTP 访问日志
CMD sh -c "rm -f /tmp/.X*-lock && cd web_ui && xvfb-run -a --server-args='-screen 0 1920x1080x24' gunicorn -w 4 -b 0.0.0.0:5050 --access-logfile - --timeout 120 app:app"
# 4. 浏览器自动化服务必须单 worker 运行,避免多个 Gunicorn 进程同时抢占 Chromium DevTools 端口
# 5. 使用 gthread 提升单进程下的并发响应能力
CMD sh -c "rm -f /tmp/.X*-lock && cd web_ui && xvfb-run -a --server-args='-screen 0 1920x1080x24' gunicorn -w 1 --threads 8 --worker-class gthread -b 0.0.0.0:5050 --access-logfile - --timeout 120 app:app"