-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.orchestrator
More file actions
102 lines (80 loc) · 2.83 KB
/
Copy pathDockerfile.orchestrator
File metadata and controls
102 lines (80 loc) · 2.83 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Multi-stage build for Orchestrator (LangGraph workflow + FastAPI)
# This includes the full application with all LLM and workflow dependencies
# Stage 1: Builder
FROM python:3.13-slim AS builder
WORKDIR /app
# Install uv for fast dependency resolution
RUN pip install --no-cache-dir uv
# Copy dependency files
COPY pyproject.toml ./
# Copy ALL source files (orchestrator needs everything)
COPY src/ ./src/
COPY data/ ./data/
# Install ALL dependencies (including langchain, langgraph, openai, etc.)
RUN uv sync --no-dev
# Stage 2: Runtime
FROM python:3.13-slim
# Runtime arguments for proxy
ARG HTTP_PROXY=http://globalproxy.gva.icrc.priv:8080
ARG HTTPS_PROXY=http://globalproxy.gva.icrc.priv:8080
ARG NO_PROXY=localhost,127.0.0.1,.icrc.priv,.icrc.org
# Set runtime proxy environment (can be overridden by Kubernetes env vars)
ENV HTTP_PROXY=${HTTP_PROXY} \
HTTPS_PROXY=${HTTPS_PROXY} \
NO_PROXY=${NO_PROXY}
WORKDIR /app
# Install runtime requirements
RUN pip install --no-cache-dir uv
# Copy from builder
COPY --from=builder /app /app
# Create non-root user for security
RUN groupadd -r orchestrator && useradd -r -g orchestrator orchestrator && \
mkdir -p /tmp /app/.cache && \
chown -R orchestrator:orchestrator /app /tmp /app/.cache
# Switch to non-root user
USER orchestrator
# Expose API port
EXPOSE 8080
# Set environment variables
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
LOG_LEVEL=INFO \
LOG_FORMAT=json \
PORT=8080 \
HOST=0.0.0.0
# Run FastAPI server with uvicorn
# Production settings: multiple workers, proper logging
CMD ["uv", "run", "--no-cache", "uvicorn", \
"src.talk2yourdata_mcp.webapp.main:app", \
"--host", "0.0.0.0", \
"--port", "8080", \
"--workers", "2", \
"--log-level", "info", \
"--access-log", \
"--no-use-colors"]
# Build command:
# podman build -f Dockerfile.orchestrator -t your-registry/dhis2-orchestrator:v1.0 .
# podman push your-registry/dhis2-orchestrator:v1.0
# For local testing:
# podman run -it --rm \
# -e MCP_SERVER_URL=http://mcp-server:8080 \
# -e LLM_API_KEY=your-openai-key \
# -e LLM_MODEL_NAME=gpt-4o \
# -p 8080:8080 \
# your-registry/dhis2-orchestrator:v1.0
# For debugging (with shell access):
# podman run -it --rm \
# -e MCP_SERVER_URL=http://mcp-server:8080 \
# --entrypoint /bin/bash \
# your-registry/dhis2-orchestrator:v1.0
# Size: Typically 800MB-1GB due to ML dependencies (langchain, etc.)
# Consider using a slim base image or multi-stage optimization
# if size is a concern
# Performance tuning:
# - Adjust --workers based on CPU cores and memory
# - For CPU-bound workloads: workers = (2 * CPU cores) + 1
# - For I/O-bound workloads: workers = (4 * CPU cores)
# - Default 2 workers is safe for most deployments
#
# Memory per worker: ~500MB-1GB depending on LLM usage
# Recommended: 2GB memory limit = 2 workers max