@@ -55,21 +55,29 @@ COPY requirements.txt .
5555RUN --mount=type=cache,target=${PIP_CACHE_DIR},sharing=locked \
5656 pip install -r requirements.txt
5757
58- # Install test requirements if needed
58+ # Install test requirements if needed (install before mim to ensure numpy is available)
5959COPY requirements-test.txt .
6060# build only when TEST_ENV="true"
6161RUN --mount=type=cache,target=${PIP_CACHE_DIR},sharing=locked \
6262 if [ "$TEST_ENV" = "true" ]; then \
6363 pip install -r requirements-test.txt; \
6464 fi
6565
66- RUN mim install mmengine==0.10.3
67- RUN mim install mmcv==2.1.0
68- RUN mim install mmdet==3.3.0
66+ # Ensure numpy is available and pinned before mim installs (mim packages may depend on it)
67+ RUN python -c "import numpy; print(f'numpy version: {numpy.__version__}')" || pip install "numpy~=1.26"
68+
69+ # Install mim packages, but prevent numpy from being upgraded
70+ RUN mim install mmengine==0.10.3 && \
71+ mim install mmcv==2.1.0 && \
72+ mim install mmdet==3.3.0 && \
73+ pip install --force-reinstall --no-deps "numpy~=1.26" || true
6974RUN mim download mmdet --config yolov3_mobilenetv2_8xb24-320-300e_coco --dest .
7075
7176COPY . .
7277
78+ # Final verification that numpy is available (important for tests)
79+ RUN python -c "import numpy; print(f'✓ numpy {numpy.__version__} is available')" || (echo "ERROR: numpy is not available!" && exit 1)
80+
7381EXPOSE 9090
7482
7583CMD gunicorn --preload --bind :$PORT --workers $WORKERS --threads $THREADS --timeout 0 _wsgi:app
0 commit comments