Spaces:
Sleeping
Sleeping
| FROM python:3.9-slim | |
| # Install system dependencies first as root | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| gcc python3-dev \ | |
| && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /app | |
| # Copy requirements first for caching | |
| COPY requirements.txt . | |
| # Install Python dependencies system-wide | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy application files | |
| COPY . . | |
| # Create non-root user and set permissions | |
| RUN useradd -m appuser && chown -R appuser:appuser /app | |
| USER appuser | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |