forked from eval-sys/mcpmark
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
101 lines (82 loc) · 2.82 KB
/
Dockerfile
File metadata and controls
101 lines (82 loc) · 2.82 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
# MCPMark Docker image with optimized layer caching
# Stage 1: Builder for Python dependencies only
FROM python:3.12-slim AS builder
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
g++ \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /build
# Copy project files needed for pip install
COPY pyproject.toml ./
COPY src/ ./src/
COPY tasks/ ./tasks/
# Install dependencies
RUN pip install --no-cache-dir --user .
# Stage 2: Final image with all runtime dependencies
FROM python:3.12-slim
# Layer 1: Core system dependencies (very stable, rarely changes)
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Layer 2: PostgreSQL runtime and client tools (stable, only changes with postgres version)
RUN apt-get update && apt-get install -y --no-install-recommends \
libpq5 \
postgresql-client \
&& rm -rf /var/lib/apt/lists/*
# Layer 3: Git (stable)
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
&& rm -rf /var/lib/apt/lists/*
# Layer 4: Playwright system dependencies (changes with browser requirements)
RUN apt-get update && apt-get install -y --no-install-recommends \
libnss3 \
libnspr4 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libcups2 \
libdrm2 \
libxkbcommon0 \
libatspi2.0-0 \
libx11-6 \
libxcomposite1 \
libxdamage1 \
libxfixes3 \
libxrandr2 \
libgbm1 \
libxcb1 \
libpango-1.0-0 \
libcairo2 \
libasound2 \
&& rm -rf /var/lib/apt/lists/*
# Layer 5: Download tools and Node.js (changes with Node version)
RUN apt-get update && \
apt-get install -y --no-install-recommends curl wget unzip && \
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get install -y --no-install-recommends nodejs && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*
# Layer 6: pipx (rarely changes)
RUN pip install --no-cache-dir pipx && \
pipx ensurepath
# Layer 7: Copy Python packages from builder (changes with dependencies)
COPY --from=builder /root/.local /root/.local
# Layer 8: Playwright browsers (changes with browser versions)
RUN python3 -m playwright install chromium && \
npx -y playwright install chromium
# Layer 9: Install PostgreSQL MCP server (Python, used via `pipx run postgres-mcp`)
RUN pipx install postgres-mcp
# Set working directory
WORKDIR /app
# Layer 9: Create directory structure (rarely changes)
RUN mkdir -p /app/results
# Layer 10: Application code (changes frequently)
COPY . .
# Set environment
ENV PATH="/root/.local/bin:/root/.local/pipx/venvs/*/bin:${PATH}"
ENV PYTHONPATH="/app"
ENV PLAYWRIGHT_BROWSERS_PATH=/root/.cache/ms-playwright
ENV PIPX_HOME=/root/.local/pipx
ENV PIPX_BIN_DIR=/root/.local/bin
# Default command
CMD ["python3", "-m", "pipeline", "--help"]