优化部署逻辑,不再下载opencv-python(完整版)
This commit is contained in:
1 parent
4cb65337d7
commit
1d72018eb7
4 files changed
+24
-6
No files matched your search
+8
-4
@@ -43,7 +43,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Python dependencies
|
||||
COPY backend/requirements.txt .
|
||||
COPY backend/requirements.txt backend/requirements-ocr.txt ./
|
||||
RUN --mount=type=cache,target=/root/.cache/pip \
|
||||
set -eux; \
|
||||
PIP_ARGS="--no-cache-dir --retries 10 --timeout 60"; \
|
||||
@@ -54,9 +54,13 @@ RUN --mount=type=cache,target=/root/.cache/pip \
|
||||
PIP_ARGS="$PIP_ARGS --extra-index-url ${PIP_EXTRA_INDEX_URL}"; \
|
||||
fi; \
|
||||
pip install $PIP_ARGS -r requirements.txt && \
|
||||
pip uninstall -y opencv-python && \
|
||||
pip install $PIP_ARGS opencv-python-headless && \
|
||||
python -c "import networkx, openpyxl"
|
||||
pip install $PIP_ARGS \
|
||||
"$(grep '^opencv-python-headless' requirements-ocr.txt)" && \
|
||||
pip install $PIP_ARGS --no-deps \
|
||||
"$(grep '^rapidocr-onnxruntime' requirements-ocr.txt)" && \
|
||||
pip install $PIP_ARGS \
|
||||
pyclipper Shapely six onnxruntime && \
|
||||
python -c "import cv2; from rapidocr_onnxruntime import RapidOCR; import networkx, openpyxl"
|
||||
|
||||
# Copy backend code and the Text2SQL schema required at runtime
|
||||
COPY backend/ .
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
# OCR stack for edkb_system (knowledge-base document image text).
|
||||
# Docker: installed by backend/Dockerfile (headless first, rapidocr --no-deps).
|
||||
# Local dev (avoid downloading opencv-python twice):
|
||||
# pip install -r requirements.txt
|
||||
# pip install "opencv-python-headless>=4.5.1.48,<5"
|
||||
# pip install rapidocr-onnxruntime==1.4.4 --no-deps
|
||||
# pip install pyclipper Shapely six onnxruntime
|
||||
opencv-python-headless>=4.5.1.48,<5
|
||||
rapidocr-onnxruntime==1.4.4
|
||||
pyclipper
|
||||
Shapely
|
||||
six
|
||||
onnxruntime
|
||||
@@ -23,8 +23,8 @@ pywin32; sys_platform == "win32"
|
||||
# File Parsing & edkb_system dependencies from xinxin2
|
||||
networkx==3.5
|
||||
python-docx==1.2.0
|
||||
rapidocr-onnxruntime==1.4.4
|
||||
opencv-python-headless
|
||||
# OCR stack (opencv + rapidocr) installed via requirements-ocr.txt in Dockerfile
|
||||
# to avoid pip pulling the larger opencv-python wheel as a rapidocr dependency.
|
||||
pillow==11.3.0
|
||||
numpy==2.3.3
|
||||
pypdf==6.1.0
|
||||
|
||||
Reference in new issue
Block a user