Spaces:
Sleeping
Sleeping
| FROM python:3.11-slim | |
| ENV DEBIAN_FRONTEND=noninteractive \ | |
| PYTHONUNBUFFERED=1 \ | |
| PYTHONDONTWRITEBYTECODE=1 \ | |
| PORT=7860 | |
| WORKDIR /app | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| curl \ | |
| && apt-get clean && rm -rf /var/lib/apt/lists/* | |
| # Upgrade build tools | |
| RUN pip install --no-cache-dir --upgrade pip setuptools wheel | |
| # Install dependencies (no heavy CUDA packages needed for LangChain HF Endpoint!) | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| COPY . . | |
| RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app | |
| USER appuser | |
| EXPOSE 7860 | |
| HEALTHCHECK --interval=60s --timeout=15s --start-period=30s --retries=3 \ | |
| CMD curl -f http://localhost:7860/api/health || exit 1 | |
| # Start uvicorn, ensuring sys.path includes the root so `app.` imports work | |
| CMD ["python", "-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"] | |