Some checks failed
Test Dashboard / test-and-dashboard (push) Has been cancelled
- Add Dockerfile with multi-stage build using uv - Add docker-compose.yml with caddy-docker-proxy labels for /mcp endpoint - Add .env.example for deployment configuration - Update Makefile with docker-* targets - Update server.py to support MCP_TRANSPORT env var: - 'stdio' (default): Local CLI usage with Claude Code - 'streamable-http': Hosted HTTP mode behind reverse proxy Hosted server will be available at: https://mcwaddams.supported.systems/mcp
77 lines
2.1 KiB
Docker
77 lines
2.1 KiB
Docker
# mcwaddams MCP Server - Production Dockerfile
|
|
# "I was told there would be document extraction..."
|
|
|
|
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Install build dependencies
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
build-essential \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy dependency files first for better caching
|
|
COPY pyproject.toml uv.lock* ./
|
|
|
|
# Install dependencies (without the project itself)
|
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
uv sync --frozen --no-install-project --no-dev
|
|
|
|
# Copy source code
|
|
COPY src/ ./src/
|
|
COPY README.md LICENSE ./
|
|
|
|
# Install the project
|
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
uv sync --frozen --no-dev
|
|
|
|
# ============================================
|
|
# Production image
|
|
# ============================================
|
|
FROM python:3.12-slim-bookworm AS production
|
|
|
|
WORKDIR /app
|
|
|
|
# Create non-root user
|
|
RUN groupadd --gid 1000 mcwaddams && \
|
|
useradd --uid 1000 --gid mcwaddams --shell /bin/bash --create-home mcwaddams
|
|
|
|
# Install runtime dependencies (for some document processing)
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
libxml2 \
|
|
libxslt1.1 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy virtual environment from builder
|
|
COPY --from=builder /app/.venv /app/.venv
|
|
|
|
# Copy source
|
|
COPY --from=builder /app/src /app/src
|
|
COPY --from=builder /app/README.md /app/LICENSE ./
|
|
|
|
# Set environment
|
|
ENV PATH="/app/.venv/bin:$PATH"
|
|
ENV PYTHONPATH="/app/src"
|
|
ENV PYTHONUNBUFFERED=1
|
|
ENV UV_COMPILE_BYTECODE=1
|
|
|
|
# Default to streamable-http transport for hosted mode
|
|
ENV MCP_TRANSPORT=streamable-http
|
|
ENV MCP_HOST=0.0.0.0
|
|
ENV MCP_PORT=8000
|
|
|
|
# Temp directory for document processing
|
|
RUN mkdir -p /tmp/mcwaddams && chown mcwaddams:mcwaddams /tmp/mcwaddams
|
|
ENV OFFICE_TEMP_DIR=/tmp/mcwaddams
|
|
|
|
USER mcwaddams
|
|
|
|
EXPOSE 8000
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health')" || exit 1
|
|
|
|
# Run the server
|
|
CMD ["python", "-m", "mcwaddams.server"]
|