Spaces:
Sleeping
Sleeping
| FROM python:3.9-slim | |
| WORKDIR /app | |
| # Install system dependencies if needed (e.g. for OpenCV if strictly required, but we use PIL) | |
| # RUN apt-get update && apt-get install -y libgl1-mesa-glx && rm -rf /var/lib/apt/lists/* | |
| COPY requirements.txt . | |
| # Install dependencies | |
| # Using the CPU-only index for PyTorch to keep image size smaller | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| COPY . . | |
| # Create a non-root user (optional but good practice, HF Spaces runs as user 1000 usually) | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| WORKDIR /app | |
| # Expose the port used by HF Spaces | |
| EXPOSE 7860 | |
| # Command to run the application | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |