listing-search / Dockerfile
“gobin.bastola”
Pre-download SigLIP model and configure cache paths
12ec497
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Configure Hugging Face cache directories with write access
ENV HF_HOME=/app/hf_cache \
TRANSFORMERS_CACHE=/app/hf_cache \
HF_DATASETS_CACHE=/app/hf_cache
RUN mkdir -p /app/hf_cache
# Pre-download SigLIP model weights and processor during build
RUN python - <<'PY'
from transformers import AutoModel, AutoProcessor
model = "google/siglip2-base-patch16-384"
print("Downloading", model)
AutoProcessor.from_pretrained(model)
AutoModel.from_pretrained(model)
print("Model assets cached")
PY
COPY . .
ENV IMAGE_EMBEDDINGS_PATH=/app/embeddings/image_embeddings.parquet
ENV CAPTION_EMBEDDINGS_PATH=/app/embeddings/caption_embeddings.parquet
ENV SIGLIP_MODEL=google/siglip2-base-patch16-384
ENV IMAGE_SCORE_WEIGHT=0.3
ENV CAPTION_SCORE_WEIGHT=0.2
ENV NLP_SCORE_WEIGHT=0.5
ENV NLP_BOOST_FACTOR=2.0
EXPOSE 7860
CMD ["uvicorn", "search_service:app", "--host", "0.0.0.0", "--port", "7860"]