Spaces:
Runtime error
Runtime error
| # Use Python 3.11 base image | |
| FROM python:3.11-slim | |
| # Create user for security (required by HF Spaces) | |
| RUN useradd -m -u 1000 user | |
| # Set working directory | |
| WORKDIR /app | |
| # Copy requirements first (better caching) | |
| COPY --chown=user requirements.txt . | |
| # Install dependencies | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # Copy application code | |
| COPY --chown=user . . | |
| # Switch to non-root user (HF Spaces requirement) | |
| USER user | |
| # Set environment variables | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH \ | |
| PYTHONUNBUFFERED=1 | |
| # Expose port 7860 (HF Spaces default) | |
| EXPOSE 7860 | |
| # Start application | |
| CMD ["python", "app.py"] |