Yashashvibhardwaj's picture
Update Dockerfile
1204afc verified
raw
history blame contribute delete
923 Bytes
# 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"]