-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (40 loc) · 1.35 KB
/
Dockerfile
File metadata and controls
54 lines (40 loc) · 1.35 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
# Medical Calculator MCP Server
# Supports both STDIO (local) and SSE (remote) modes
FROM python:3.11-slim
LABEL maintainer="Medical-Calc-MCP"
LABEL description="Medical Calculator MCP Server for AI Agent Integration"
LABEL version="1.2.0"
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
# Copy dependency files
COPY pyproject.toml uv.lock ./
# Install dependencies
RUN uv sync --frozen --no-install-project
# Copy source code
COPY src/ ./src/
# Install the project
RUN uv sync --frozen
# Create non-root user for security
RUN useradd --create-home --shell /bin/bash mcpuser
RUN chown -R mcpuser:mcpuser /app
USER mcpuser
# Environment variables
ENV PATH="/app/.venv/bin:$PATH"
ENV PYTHONPATH=/app
ENV PYTHONUNBUFFERED=1
ENV MCP_MODE=sse
ENV MCP_HOST=0.0.0.0
ENV MCP_PORT=8000
# Expose port for SSE mode
EXPOSE 8000
# Health check using /health endpoint (custom endpoint for liveness probes)
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -sf http://localhost:${MCP_PORT}/health -o /dev/null -m 5 || exit 1
# Default command: Run in SSE mode
CMD ["python", "-m", "src.main", "--mode", "sse", "--host", "0.0.0.0", "--port", "8000"]