FROM python:3.11-slim # Set environment variables ENV PYTHONUNBUFFERED=1 \ PYTHONDONTWRITEBYTECODE=1 \ PORT=7860 # Create user and set permissions (HF expectation) RUN useradd -m -u 1000 user WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ build-essential \ curl \ software-properties-common \ && rm -rf /var/lib/apt/lists/* # Copy requirements and install COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy app code COPY . . # Set permissions for user 1000 RUN chown -R 1000:1000 /app USER user # Expose port EXPOSE 7860 # Run entrypoint ENTRYPOINT ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]