Files
proxmox-mcp-custom/Dockerfile
Ben 18a8c2e59f
All checks were successful
Build and Push Proxmox MCP Docker Image / build (push) Successful in 32s
feat: add /health endpoint bypassing transport security
- Migrate from SSE to HTTP transport using fastmcp>=2.0
- Add /health endpoint for Docker health checks and load balancers
- Remove MCP_ALLOWED_HOSTS (no longer needed with http_app approach)
- Add lifespan handler for proper task group initialization
- Install curl in Docker image for health checks
- Update Makefile with test-health and test-mcp targets
- Update documentation to reflect new endpoint structure

Fixes: Health check fails with 421 Misdirected Request when
MCP_ALLOWED_HOSTS doesn't include localhost
2025-12-20 23:17:55 +00:00

41 lines
1.2 KiB
Docker

# Stage 1: Builder for dependencies
FROM python:3.11-slim-bullseye AS builder
WORKDIR /app
# Install uv
RUN pip install uv
# Copy only dependency files first to leverage Docker cache
COPY pyproject.toml ./
# Install dependencies with uv
# Use 'uv pip install --system' to install directly into the system python environment
# This avoids creating a virtualenv inside the Docker build stage
RUN uv pip install --system .
# Stage 2: Final image
FROM python:3.11-slim-bullseye
WORKDIR /app
# Install curl for health checks
RUN apt-get update && apt-get install -y --no-install-recommends curl \
&& rm -rf /var/lib/apt/lists/*
# Copy installed dependencies from builder
# We copy the entire site-packages directory
COPY --from=builder /usr/local/lib/python3.11/site-packages/ /usr/local/lib/python3.11/site-packages/
# Also copy uv itself (optional, but good for debugging)
COPY --from=builder /usr/local/bin/uv /usr/local/bin/uv
# And the bin directory for executables like 'uvicorn'
COPY --from=builder /usr/local/bin/ /usr/local/bin/
# Copy application code
COPY server.py ./
# Expose the port Uvicorn will listen on
EXPOSE 8000
# Run the Uvicorn server
CMD ["python", "server.py"]