优化部署逻辑,不再下载opencv-python(完整版)

This commit is contained in:
sophie committed 2026-05-28 13:28:35 +08:00
1 parent 4cb65337d7
commit 1d72018eb7
4 files changed
+24 -6

No files matched your search

+8 -4
View File
@@ -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/ .