# Use a lightweight Python base image FROM python:3.10-slim # Set up a non-root user for Hugging Face Spaces RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:$PATH" # Set the working directory WORKDIR /app # Copy the requirements file and install dependencies COPY --chown=user requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy the actual application code COPY --chown=user app.py . # Expose the standard Space port EXPOSE 7860 # Boot up the FastAPI server CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]