抓取生产工单,抓取发料异常

This commit is contained in:
hjq
2026-06-12 15:29:34 +08:00
parent 0fa2fc0f90
commit 422d814d02
4 changed files with 189 additions and 0 deletions

41
Dockerfile Normal file
View File

@@ -0,0 +1,41 @@
# 使用官方 Python 基础镜像 (Debian 体系)
FROM python:3.9-slim
# 设置工作目录
WORKDIR /app
# 防止 apt-get 安装时出现交互式弹窗(比如选择时区)导致卡死
ENV DEBIAN_FRONTEND=noninteractive
# Debian 12 (Bookworm) 的 apt 源文件变成了 /etc/apt/sources.list.d/debian.sources
# 这里替换源以加速下载,并安装必要的系统依赖
# 必须安装Xvfb(虚拟屏幕), Chromium(浏览器核心), 中文字体(防乱码)
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources 2>/dev/null || \
sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list 2>/dev/null || true && \
apt-get update && \
apt-get install -y --no-install-recommends \
xvfb \
chromium \
chromium-driver \
fonts-wqy-zenhei \
tzdata \
&& rm -rf /var/lib/apt/lists/*
# 设置时区为中国上海
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# 复制依赖清单并安装 Python 库
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ && \
pip install gunicorn -i https://mirrors.aliyun.com/pypi/simple/
# 复制整个项目到容器内
COPY . .
# 暴露 Flask 服务的 5050 端口
EXPOSE 5050
# 启动脚本:使用 xvfb-run 虚拟出一个屏幕来运行 Python 程序
# --server-args="-screen 0 1920x1080x24" 设置虚拟屏幕的分辨率
CMD ["xvfb-run", "--server-args=-screen 0 1920x1080x24", "gunicorn", "-w", "4", "-b", "0.0.0.0:5050", "--timeout", "120", "web_ui.app:app"]