Spaces:
Sleeping
Sleeping
| # Use an official Python runtime as a parent image | |
| FROM python:3.9-slim | |
| # Create a non-root user | |
| RUN useradd -m -u 1000 user | |
| # Switch to the new user | |
| USER user | |
| # Set home to the user's home directory and update PATH | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # Set the working directory | |
| WORKDIR $HOME/app | |
| # Install dependencies | |
| COPY --chown=user backend/requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the application code | |
| COPY --chown=user . . | |
| # Set the working directory to the backend | |
| WORKDIR $HOME/app/backend | |
| # Expose the port the app runs on | |
| EXPOSE 7860 | |
| # Run the application | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |