# Use an official lightweight Python runtime FROM python:3.9-slim # Set up a new user named "user" with UID 1000 to comply with HF Space permissions RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # Set the working directory inside the container WORKDIR $HOME/app # Copy the requirements file and install dependencies COPY --chown=user requirements.txt $HOME/app/requirements.txt RUN pip install --no-cache-dir --upgrade -r requirements.txt # Copy the rest of the application files into the container COPY --chown=user . $HOME/app # Expose port 7860 (Hugging Face expects the app to run on this port) EXPOSE 7860 # Command to run the FastAPI app via uvicorn CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]