Spaces:
Sleeping
Sleeping
| # 1. Base image | |
| FROM python:3.9 | |
| # 2. Install system deps for RealESRGAN & PIL | |
| RUN apt-get update && \ | |
| apt-get install -y --no-install-recommends \ | |
| git build-essential \ | |
| libsm6 libxext6 libxrender1 \ | |
| libgl1-mesa-glx && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # 3. Create non-root user (for pip cache ownership) | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| # 4. Workdir & Python deps | |
| WORKDIR /app | |
| COPY --chown=user requirements.txt . | |
| RUN pip install --no-cache-dir --upgrade pip \ | |
| && pip install --no-cache-dir -r requirements.txt | |
| # 5. Copy app code | |
| COPY --chown=user . . | |
| # 6. Expose & run | |
| EXPOSE 7860 | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--log-level", "debug"] | |