no model download on imaeg build
All checks were successful
build_docker / essential (pull_request) Successful in 0s
build_docker / build_cpu (linux/amd64) (pull_request) Successful in 3m55s
build_docker / build_gpu (pull_request) Successful in 11m43s
build_docker / build_cpu (linux/arm64) (pull_request) Successful in 21m23s

This commit is contained in:
2026-01-17 12:06:17 +01:00
parent 4f53d288b2
commit 58bf94bc41
2 changed files with 6 additions and 18 deletions

View File

@@ -34,15 +34,9 @@ ARG REC_MODEL=PP-OCRv5_server_rec
ENV PADDLE_DET_MODEL=${DET_MODEL} ENV PADDLE_DET_MODEL=${DET_MODEL}
ENV PADDLE_REC_MODEL=${REC_MODEL} ENV PADDLE_REC_MODEL=${REC_MODEL}
# Download models during build (not at runtime) # Note: Models download at first runtime
RUN python -c "\ # First container start will take ~30s longer as models are fetched
import os; \ # Use paddlex-cache volume to persist models across container restarts
from paddleocr import PaddleOCR; \
det = os.environ.get('PADDLE_DET_MODEL', 'PP-OCRv5_server_det'); \
rec = os.environ.get('PADDLE_REC_MODEL', 'PP-OCRv5_server_rec'); \
print(f'Downloading models: det={det}, rec={rec}'); \
ocr = PaddleOCR(text_detection_model_name=det, text_recognition_model_name=rec); \
print('Models downloaded successfully!')"
# Volume for dataset and optional additional model cache # Volume for dataset and optional additional model cache
VOLUME ["/app/dataset", "/root/.paddlex"] VOLUME ["/app/dataset", "/root/.paddlex"]

View File

@@ -77,15 +77,9 @@ ARG REC_MODEL=PP-OCRv5_server_rec
ENV PADDLE_DET_MODEL=${DET_MODEL} ENV PADDLE_DET_MODEL=${DET_MODEL}
ENV PADDLE_REC_MODEL=${REC_MODEL} ENV PADDLE_REC_MODEL=${REC_MODEL}
# Download models during build (not at runtime) # Note: Models download at first runtime (CI runner has no GPU for build-time download)
RUN python -c "\ # First container start will take ~30s longer as models are fetched
import os; \ # Use paddlex-cache volume to persist models across container restarts
from paddleocr import PaddleOCR; \
det = os.environ.get('PADDLE_DET_MODEL', 'PP-OCRv5_server_det'); \
rec = os.environ.get('PADDLE_REC_MODEL', 'PP-OCRv5_server_rec'); \
print(f'Downloading models: det={det}, rec={rec}'); \
ocr = PaddleOCR(text_detection_model_name=det, text_recognition_model_name=rec); \
print('Models downloaded successfully!')"
# Volume for dataset and optional additional model cache # Volume for dataset and optional additional model cache
VOLUME ["/app/dataset", "/root/.paddlex"] VOLUME ["/app/dataset", "/root/.paddlex"]