| FROM python:3.9-slim | |
| # Create non-root user | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| # Set working directory | |
| WORKDIR /home/user/app | |
| # Copy and install requirements | |
| COPY --chown=user:user ./requirements.txt requirements.txt | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| # Copy the app | |
| COPY --chown=user:user ./app.py app.py | |
| # Expose port 7860 | |
| EXPOSE 7860 | |
| # Run the app | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |