File size: 923 Bytes
37990d9 3eaabcf 37990d9 3eaabcf 37990d9 3eaabcf 37990d9 3eaabcf 37990d9 1204afc 3eaabcf 1204afc 37990d9 3eaabcf 37990d9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# Base image
FROM python:3.11-slim
# Set working directory
WORKDIR /app
# System dependencies
RUN apt-get update && apt-get install -y git wget curl build-essential && rm -rf /var/lib/apt/lists/*
# Copy requirements first (to leverage Docker cache)
COPY requirements.txt .
# Install Python deps
RUN pip install --no-cache-dir -r requirements.txt
# Setup cache dir
ENV HF_HOME=/app/cache
ENV TRANSFORMERS_CACHE=/app/cache
ENV SENTENCE_TRANSFORMERS_HOME=/app/cache
# Pre-download model during build
RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('sentence-transformers/clip-ViT-B-32', cache_folder='/app/cache')"
# Copy the rest of the code and prebuilt index + metadata
COPY . .
# ❌ Remove this line (don’t rebuild index each deploy)
# RUN python build_index.py
# Expose port
EXPOSE 7860
# Start API
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|