Spaces:
Sleeping
Sleeping
| FROM python:3.11-slim-bookworm | |
| WORKDIR /app | |
| # Copy and install dependencies first (cache layer optimization) | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy all project files | |
| COPY . . | |
| # Set environment variables for docker and huggingface | |
| ENV PYTHONPATH="/app:$PYTHONPATH" | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV PORT=7860 | |
| ENV OPENENV_WEB_INTERFACE=true | |
| # Health check | |
| HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \ | |
| CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/health')" || exit 1 | |
| # HF Spaces requires port 7860 | |
| EXPOSE 7860 | |
| # Run the FastAPI server | |
| CMD ["uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "7860"] | |