# Use Python base image FROM python:3.10-slim # Set environment variables ENV HF_HOME=/app/hf_cache ENV TRANSFORMERS_CACHE=/app/hf_cache ENV SENTENCE_TRANSFORMERS_HOME=/app/hf_cache # Install system deps RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* # Install Python deps COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Pre-download the model RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')" # Copy app code COPY . /app WORKDIR /app # Expose port EXPOSE 7860 # Start the app CMD ["python", "app.py"]