| FROM python:3.12-slim | |
| # Set up a non-root user | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| # Set the working directory in the container | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| WORKDIR $HOME/app | |
| # Copy the dependencies file and install them | |
| COPY --chown=user requirements.txt . | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| # Copy the rest of the application code | |
| COPY --chown=user . . | |
| # Command to run the application | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |