# Build stage
FROM rust:1.87-slim AS builder
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Create app directory
WORKDIR /app
# Copy manifests
COPY Cargo.toml Cargo.lock ./
# Copy source code
COPY src ./src
COPY templates ./templates
# Build the stateless MCP server binary
RUN cargo build --release --bin pmat
# Runtime stage
FROM debian:bookworm-slim
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
libssl3 \
&& rm -rf /var/lib/apt/lists/*
# Copy the binary from builder
COPY --from=builder /app/target/release/pmat /usr/local/bin/pmat
# Create non-root user
RUN useradd -m -u 1000 mcp-user
USER mcp-user
# Set entrypoint
ENTRYPOINT ["/usr/local/bin/pmat"]