Spaces:
Sleeping
Sleeping
| FROM python:3.11-slim | |
| # Set environment variables to keep Python from buffering and writing .pyc | |
| ENV PYTHONDONTWRITEBYTECODE=1 | |
| ENV PYTHONUNBUFFERED=1 | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Upgrade pip and install uvicorn/fastapi EXPLICITLY first | |
| RUN pip install --no-cache-dir --upgrade pip | |
| RUN pip install --no-cache-dir uvicorn fastapi | |
| # Copy the rest of the requirements and install | |
| COPY backend-ml/requirements-lite.txt /app/ | |
| RUN pip install --no-cache-dir -r requirements-lite.txt | |
| # Copy the project files | |
| COPY . /app/ | |
| # Ensure we are in the directory where main.py lives | |
| WORKDIR /app/backend-ml | |
| # Final check: port 7860 is required for Hugging Face | |
| EXPOSE 7860 | |
| # Launch using the python -m method | |
| CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |