| FROM python:3.11-slim | |
| # Install basic system tools | |
| RUN apt-get update && apt-get install -y \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create a non-root user for Hugging Face (UID 1000) | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| WORKDIR $HOME/app | |
| # Copy your local files into the container | |
| # This replaces the 'git clone' step and works with private code | |
| COPY --chown=user . $HOME/app | |
| # Install dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Run the FastAPI app using Uvicorn | |
| CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"] |