File size: 1,244 Bytes
9378d43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0e0e09a
 
 
9378d43
 
 
 
 
 
ce94df5
 
9378d43
ce94df5
 
9378d43
 
ce94df5
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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"]