FROM python:3.11-slim # Install system dependencies RUN apt-get update && apt-get install -y \ git \ wget \ && rm -rf /var/lib/apt/lists/* # Create user RUN useradd -m -u 1000 user WORKDIR /app # Copy requirements COPY --chown=user requirements.txt . # Install Python packages (includes pre-built flash-attn wheel!) RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir -r requirements.txt # Copy application COPY --chown=user . . # Switch to user USER user # Set environment variables ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # Expose port EXPOSE 7860 # Run the application CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]