File size: 1,344 Bytes
f647629
 
 
 
 
 
 
 
 
 
 
 
 
 
40e4410
 
f647629
 
 
 
 
 
 
 
561151f
f647629
561151f
f647629
 
 
 
 
2325f96
 
f647629
2d37ec5
 
 
 
 
 
f647629
2325f96
f647629
1ec3391
40e4410
 
1ec3391
 
 
 
 
 
 
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
FROM python:3.11-slim

# Set working directory
WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y \
    git \
    curl \
    && rm -rf /var/lib/apt/lists/*

# Copy requirements first for better caching
COPY requirements.txt .

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy the source code
COPY src/ ./src/
COPY pyproject.toml .

# Install the package in development mode
RUN pip install -e .

# Copy the app entry point and landing page
COPY app.py .
COPY index.html .

# Set environment variables
ENV PYTHONPATH=/app/src
ENV WANDB_SILENT=True
ENV WEAVE_SILENT=True
ENV MCP_TRANSPORT=http
ENV HOST=0.0.0.0

# Set W&B cache directories to writable locations
ENV WANDB_CACHE_DIR=/tmp/.wandb_cache
ENV WANDB_CONFIG_DIR=/tmp/.wandb_config
ENV WANDB_DATA_DIR=/tmp/.wandb_data
ENV HOME=/tmp

# Expose port for HTTP transport
EXPOSE 7860

# Run with single worker using Uvicorn's async event loop
# MCP protocol requires stateful session management (in-memory sessions)
# Single async worker handles high concurrency via event loop (1000+ concurrent connections)
CMD ["uvicorn", "app:app", \
     "--host", "0.0.0.0", \
     "--port", "7860", \
     "--workers", "1", \
     "--log-level", "info", \
     "--timeout-keep-alive", "120", \
     "--limit-concurrency", "1000"]