Spaces:
Sleeping
Sleeping
| FROM python:3.10-slim | |
| WORKDIR /app | |
| # Install curl for health checks | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy requirements and install dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy application files | |
| COPY edgar_client.py . | |
| COPY financial_analyzer.py . | |
| COPY mcp_server_sse.py . | |
| # Copy templates directory | |
| COPY templates/ templates/ | |
| # Expose port | |
| EXPOSE 7860 | |
| # Set environment variables for production | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV PYTHONDONTWRITEBYTECODE=1 | |
| ENV REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt | |
| ENV CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt | |
| # Health check for container monitoring - relaxed for stability | |
| HEALTHCHECK --interval=90s --timeout=20s --start-period=90s --retries=5 \ | |
| CMD curl -f http://localhost:7860/health || exit 1 | |
| # Run MCP Server with SSE transport - optimized for stability | |
| CMD ["uvicorn", "mcp_server_sse:app", "--host", "0.0.0.0", "--port", "7860", "--timeout-keep-alive", "180", "--timeout-graceful-shutdown", "30", "--limit-concurrency", "30", "--backlog", "50", "--log-level", "info", "--workers", "1", "--no-access-log"] | |