FROM python:3.11-slim WORKDIR /app RUN apt-get update && apt-get install -y --no-install-recommends \ libjpeg62-turbo \ libpng16-16 \ libheif1 \ && rm -rf /var/lib/apt/lists/* # Install CPU-only torch AND torchvision from the same index first (keeps the # image GPU-free; timm needs a MATCHING torchvision or it raises # "operator torchvision::nms does not exist"). Then the rest of the deps. RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu COPY api/requirements.txt /app/requirements.txt RUN pip install --no-cache-dir -r /app/requirements.txt # Bake DINOv2 weights so the first identify is fast (no runtime download). RUN python -c "import timm; timm.create_model('vit_small_patch14_dinov2.lvd142m', pretrained=True)" # Copy backend + algorithm modules (v6 measurement = v5 + robust tick + dense-warp # corrector ensemble + recognizer + deps) COPY api /app/api COPY epi_ppi_v4_1.py epi_ppi_v4_2.py epi_ppi_v5.py epi_ppi_v6.py \ classfix_combined.py classfix_harmonic_comb.py classfix_motif_removal.py \ classfix_autocorr_cepstrum.py classfix_gradient_edge.py classfix_local_bandpass.py \ robust_tick.py fabric_recognize.py ruler_freq.py migrate_catalog_v6.py /app/ ENV FABRIC_ALGO_DIR=/app ENV PORT=8000 EXPOSE 8000 CMD ["sh", "-c", "uvicorn api.server:app --host 0.0.0.0 --port ${PORT}"]