FROM python:3.10-slim # Set up a non-root user (HF containers run as user ID 1000) RUN useradd -m -u 1000 user WORKDIR /home/user/app # Install system dependencies RUN apt-get update && apt-get install -y \ curl \ git \ && rm -rf /var/lib/apt/lists/* # Install Python packages COPY requirements.txt ./ RUN pip install --no-cache-dir -r requirements.txt # Copy all your files COPY . . ENV HF_HOME=/home/user/.cache/huggingface # Run as the HF user to avoid permission issues USER user # Start the FastAPI server CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]