mcrentcast/Dockerfile
Ryan Malloy 8b4f9fbfff Initial implementation of mcrentcast MCP server
- Complete Rentcast API integration with all endpoints
- Intelligent caching system with hit/miss tracking
- Rate limiting with exponential backoff
- User confirmation system with MCP elicitation support
- Docker Compose setup with dev/prod modes
- PostgreSQL database for persistence
- Comprehensive test suite foundation
- Full project structure and documentation
2025-09-09 08:41:23 -06:00

80 lines
2.2 KiB
Docker

# Multi-stage Docker build for mcrentcast MCP server
FROM ghcr.io/astral-sh/uv:0.5.13-python3.13-bookworm-slim AS base
# Install system dependencies
RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*
# Set environment variables for uv
ENV UV_COMPILE_BYTECODE=1 \
UV_LINK_MODE=copy \
PYTHONPATH="/app/src:$PYTHONPATH" \
PYTHONUNBUFFERED=1
WORKDIR /app
# Create non-root user
RUN useradd --create-home --shell /bin/bash app && \
chown -R app:app /app
USER app
# Development stage
FROM base AS development
ENV UV_COMPILE_BYTECODE=0
# Copy dependency files
COPY --chown=app:app pyproject.toml uv.lock ./
# Install dependencies with cache mount
RUN --mount=type=cache,target=/home/app/.cache/uv \
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
uv sync --frozen --no-install-project
# Copy source code
COPY --chown=app:app . .
# Install project in editable mode
RUN --mount=type=cache,target=/home/app/.cache/uv \
uv sync --frozen
# Expose MCP server port
EXPOSE 3001
# Development command with hot reload
CMD ["uv", "run", "uvicorn", "mcrentcast.server:app", "--host", "0.0.0.0", "--port", "3001", "--reload", "--reload-dir", "/app/src"]
# Production stage
FROM base AS production
# Copy dependency files
COPY --chown=app:app pyproject.toml uv.lock ./
# Install dependencies (frozen, no dev deps)
RUN --mount=type=cache,target=/home/app/.cache/uv \
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
uv sync --frozen --no-dev --no-editable --no-install-project
# Copy source code
COPY --chown=app:app src/ ./src/
COPY --chown=app:app docs/ ./docs/
# Install project
RUN --mount=type=cache,target=/home/app/.cache/uv \
uv sync --frozen --no-dev --no-editable
# Create data directory
RUN mkdir -p /app/data && chown app:app /app/data
# Health check
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
CMD curl -f http://localhost:3001/health || exit 1
# Expose MCP server port
EXPOSE 3001
# Production command
CMD ["uv", "run", "uvicorn", "mcrentcast.server:app", "--host", "0.0.0.0", "--port", "3001", "--workers", "1"]