-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.validation
More file actions
89 lines (75 loc) · 2.79 KB
/
Dockerfile.validation
File metadata and controls
89 lines (75 loc) · 2.79 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
# Multi-stage build for MCP External Validation
FROM rust:1.85-slim AS builder
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev \
git \
curl \
&& rm -rf /var/lib/apt/lists/*
# Create app directory
WORKDIR /app
# Copy rust-toolchain.toml first to ensure consistent toolchain
COPY rust-toolchain.toml ./
RUN rustup show && rustc --version && cargo --version && cargo clippy --version
# Copy workspace files
COPY Cargo.toml ./
COPY mcp-protocol ./mcp-protocol/
COPY mcp-logging ./mcp-logging/
COPY mcp-auth ./mcp-auth/
COPY mcp-security ./mcp-security/
COPY mcp-security-middleware ./mcp-security-middleware/
COPY mcp-transport ./mcp-transport/
COPY mcp-macros ./mcp-macros/
COPY mcp-server ./mcp-server/
COPY mcp-client ./mcp-client/
COPY mcp-external-validation ./mcp-external-validation/
COPY conformance-tests ./conformance-tests/
COPY examples ./examples/
COPY integration-tests ./integration-tests/
# Build the validation tools with optimizations for smaller Docker layers
RUN cargo build --release --package pulseengine-mcp-external-validation --features "proptest,fuzzing" \
&& rm -rf target/release/deps target/release/build target/release/.fingerprint \
&& find target/release -name "*.d" -delete
# Runtime stage
FROM debian:bookworm-slim
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
libssl3 \
python3 \
python3-pip \
python3-venv \
curl \
jq \
&& rm -rf /var/lib/apt/lists/*
# Install Python MCP SDK
RUN python3 -m pip install --no-cache-dir --break-system-packages \
mcp \
aiohttp \
websockets \
pytest \
pytest-asyncio
# Install MCP Inspector (optional, skip if not available)
RUN curl -L https://github.com/anthropics/mcp-inspector/releases/latest/download/mcp-inspector-Linux.tar.gz -o /tmp/mcp-inspector.tar.gz 2>/dev/null || true \
&& if [ -f /tmp/mcp-inspector.tar.gz ] && file /tmp/mcp-inspector.tar.gz | grep -q "gzip compressed"; then \
tar -xz -C /usr/local/bin -f /tmp/mcp-inspector.tar.gz \
&& chmod +x /usr/local/bin/mcp-inspector \
&& echo "MCP Inspector installed successfully"; \
else \
echo "MCP Inspector not available, skipping installation"; \
fi \
&& rm -f /tmp/mcp-inspector.tar.gz
# Copy built binaries
COPY --from=builder /app/target/release/mcp-validate /usr/local/bin/
COPY --from=builder /app/target/release/mcp-compliance-report /usr/local/bin/
# Copy Python test scripts
COPY --from=builder /app/mcp-external-validation/python_tests /opt/mcp-tests/python_tests
# Create working directory
WORKDIR /workspace
# Set environment variables
ENV RUST_LOG=info
ENV PYTHONPATH=/opt/mcp-tests
ENV MCP_INSPECTOR_PATH=/usr/local/bin/mcp-inspector
# Default command
CMD ["mcp-validate", "--help"]