Spaces:
Sleeping
Sleeping
| # ββ Base image ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| # Use a slim Python 3.11 image; TF 2.x works well with 3.11 | |
| FROM python:3.11-slim | |
| # ββ System deps βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # ββ Working directory βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| WORKDIR /app | |
| # ββ Python dependencies βββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| # Copy requirements first to leverage Docker layer caching | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # ββ Application code ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| COPY . . | |
| # Create the models directory in case it doesn't exist | |
| RUN mkdir -p models | |
| # ββ Hugging Face Spaces requires port 7860 ββββββββββββββββββββββββββββββββββββ | |
| EXPOSE 7860 | |
| # ββ Launch ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| # Use 0.0.0.0 so the container is reachable externally | |
| # Port 7860 is mandatory for HF Spaces Docker SDK | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |