-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (39 loc) · 1.4 KB
/
Dockerfile
File metadata and controls
54 lines (39 loc) · 1.4 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
# ─────────────────────────────────────
# MCPlex Dockerfile — Multi-stage build
# Produces a minimal ~15MB container
# ─────────────────────────────────────
# Stage 1: Build
FROM rust:1.82-slim AS builder
WORKDIR /build
# Cache dependency compilation
COPY Cargo.toml Cargo.lock ./
RUN mkdir src && \
echo 'fn main() { println!("placeholder"); }' > src/main.rs && \
cargo build --release && \
rm -rf src
# Build the real binary
COPY src/ src/
RUN touch src/main.rs && cargo build --release
# Stage 2: Runtime
FROM debian:bookworm-slim AS runtime
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates curl && \
rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN groupadd -r mcplex && useradd -r -g mcplex -d /app mcplex
WORKDIR /app
# Copy binary
COPY --from=builder /build/target/release/mcplex /usr/local/bin/mcplex
# Copy default config
COPY mcplex.toml /app/mcplex.toml
# Create log directory
RUN mkdir -p /app/logs && chown -R mcplex:mcplex /app
USER mcplex
# MCP endpoint + Dashboard
EXPOSE 3100 9090
# Health check
HEALTHCHECK --interval=15s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost:3100/health || exit 1
ENTRYPOINT ["mcplex"]
CMD ["--config", "/app/mcplex.toml"]