Spaces:
Runtime error
Runtime error
| FROM python:3.10-slim | |
| # HF Spaces runs as a non-root user — this satisfies that requirement | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| WORKDIR /app | |
| # Install system deps needed by OpenCV | |
| USER root | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| libgl1 libglib2.0-0 libsm6 libxrender1 libxext6 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| USER user | |
| # Install Python deps | |
| COPY --chown=user requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy app source and model files | |
| COPY --chown=user server.py . | |
| COPY --chown=user models/ ./models/ | |
| # HF Spaces expects the app to listen on port 7860 | |
| EXPOSE 7860 | |
| CMD ["python", "server.py"] | |