Spaces:
Sleeping
Sleeping
| # Use Python 3.13 slim image as base | |
| FROM python:3.13-slim | |
| # Set working directory | |
| WORKDIR /app | |
| # Install uv for fast dependency management | |
| COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv | |
| # Set environment variables | |
| ENV PYTHONUNBUFFERED=1 \ | |
| PYTHONDONTWRITEBYTECODE=1 \ | |
| UV_SYSTEM_PYTHON=1 \ | |
| PORT=7860 | |
| # Copy project files | |
| COPY pyproject.toml uv.lock* ./ | |
| COPY server.py app.py ./ | |
| # Install dependencies using uv | |
| RUN uv pip install --system -r pyproject.toml | |
| # Expose port for HTTP server | |
| EXPOSE 7860 | |
| # Health check | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ | |
| CMD python -c "import requests; requests.get('http://localhost:7860/health')" || exit 1 | |
| # Run the FastAPI app | |
| CMD ["python", "app.py"] | |