Spaces:
Running
Running
| # Use the official Python 3.10 image | |
| FROM python:3.10-slim | |
| # Set the working directory to /code | |
| WORKDIR /code | |
| # Copy the requirements file into the container | |
| COPY ./requirements.txt /code/requirements.txt | |
| # Install the dependencies | |
| RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt | |
| # Copy the application code into the container | |
| COPY ./app /code/app | |
| # Create a non-root user to run the application (recommended for security) | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # Expose port 7860 for Hugging Face Spaces | |
| EXPOSE 7860 | |
| # Command to run the application | |
| CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"] | |