Spaces:
Sleeping
Sleeping
| # Base image | |
| FROM python:3.11-slim | |
| # Prevent Python from writing pyc files and buffering stdout | |
| ENV PYTHONDONTWRITEBYTECODE=1 | |
| ENV PYTHONUNBUFFERED=1 | |
| # Set working directory | |
| WORKDIR /app | |
| # System dependencies (minimal set) | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Install Python dependencies | |
| COPY requirements.txt /app/requirements.txt | |
| RUN pip install --no-cache-dir --upgrade pip \ | |
| && pip install --no-cache-dir -r /app/requirements.txt | |
| # Copy application code | |
| COPY . /app | |
| # Hugging Face Spaces uses port 7860 by default | |
| ENV PORT=7860 | |
| EXPOSE 7860 | |
| # Start FastAPI app | |
| CMD ["bash", "-lc", "python -m uvicorn app:app --host 0.0.0.0 --port ${PORT}"] | |