| # Use Python 3.10 for better compatibility with modern libraries | |
| FROM python:3.10-slim | |
| # Set the working directory | |
| WORKDIR /code | |
| # Copy requirements and install | |
| COPY ./requirements.txt /code/requirements.txt | |
| # Upgrade pip and install dependencies | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r /code/requirements.txt | |
| # Copy the rest of the files | |
| COPY . . | |
| # Grant permissions (sometimes needed for HF Spaces) | |
| RUN chmod -R 777 /code | |
| # Start the app | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |