Spaces:
Sleeping
Sleeping
| # 1️⃣ Use a lightweight Python base image | |
| FROM python:3.10-slim | |
| # 2️⃣ Set working directory inside container | |
| WORKDIR /app | |
| # 3️⃣ Install system dependencies (required by transformers, torch, etc.) | |
| RUN apt-get update && apt-get install -y \ | |
| git wget build-essential && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # 4️⃣ Copy dependency list | |
| COPY requirements.txt /app/ | |
| # 5️⃣ Install dependencies | |
| RUN pip install --upgrade pip | |
| RUN pip install -r requirements.txt | |
| # 6️⃣ Copy all backend code to container | |
| COPY . /app | |
| ENV TRANSFORMERS_CACHE=/app/.cache | |
| RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache | |
| # 8️⃣ Expose port 7860 (Hugging Face default) or 8000 for general use | |
| EXPOSE 7860 | |
| # 9️⃣ Run the FastAPI app using Uvicorn | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |