FROM python:3.10-slim # Hugging Face runs everything on a custom internal user, # so we need to set permissions properly for caching! WORKDIR /app RUN mkdir -p /.cache && chmod 777 /.cache # Install basic system tools RUN apt-get update && apt-get install -y \ build-essential \ libssl-dev \ curl \ && rm -rf /var/lib/apt/lists/* # Copy python requirements COPY requirements.txt . # Install python libraries RUN pip install --no-cache-dir -r requirements.txt # Download AI Models directly into the Docker Image so they boot instantly RUN python -m spacy download en_core_web_sm RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')" # Copy the rest of your backend code COPY . . # Hugging Face exposes web apps ONLY on port 7860 by default ENV PORT=7860 EXPOSE 7860 # Run FastAPI Server on port 7860 CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]