Spaces:
Sleeping
Sleeping
| FROM python:3.9-slim | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| libglib2.0-0 \ | |
| libsm6 \ | |
| libxext6 \ | |
| libxrender1 \ | |
| libgomp1 \ | |
| libgthread-2.0-0 \ | |
| libgl1 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create user | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| WORKDIR /app | |
| # Copy requirements first for better caching | |
| COPY --chown=user:1000 requirements.txt . | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # Copy model and app files | |
| COPY --chown=user:1000 best-seg.pt . | |
| COPY --chown=user:1000 best-od.pt . | |
| COPY --chown=user:1000 app.py . | |
| # Expose port 7860 (HF default) | |
| EXPOSE 7860 | |
| # Run FastAPI with optimized settings | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"] | |