FROM python:3.11-slim # Set up a clean working directory WORKDIR /code # Copy requirements file first to take advantage of Docker layer caching COPY ./requirements.txt /code/requirements.txt # Install dependencies cleanly RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt # Set up user privileges required by Hugging Face Spaces environment execution restrictions RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # Set up application working folder path configurations WORKDIR $HOME/app # Copy the rest of your application code into the container COPY --chown=user . $HOME/app # Expose port 7860 as required natively by Hugging Face routing layers CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]