Files
monarch-mcp-custom/Dockerfile
Ben 545d48bd25
All checks were successful
Build and Push Monarch MCP Docker Image / build (push) Successful in 26s
fix: install git in Docker builder for git-based dependencies
2025-12-25 04:35:58 +00:00

47 lines
1.1 KiB
Docker

# Stage 1: Builder
FROM python:3.12-slim AS builder
WORKDIR /app
# Install git (required for git-based dependencies) and uv
RUN apt-get update && apt-get install -y --no-install-recommends git \
&& rm -rf /var/lib/apt/lists/* \
&& pip install uv
# Copy pyproject.toml first to leverage Docker cache
COPY pyproject.toml .
# Copy source directory for editable install
COPY src/ ./src/
# Install dependencies into system python environment of builder
RUN uv pip install --system .
# Stage 2: Final Image
FROM python:3.12-slim
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 packages from builder
COPY --from=builder /usr/local/lib/python3.12/site-packages/ /usr/local/lib/python3.12/site-packages/
COPY --from=builder /usr/local/bin/ /usr/local/bin/
# Copy application code
COPY src/ ./src/
COPY pyproject.toml .
COPY README.md .
# Set Python path to find package
ENV PYTHONPATH=/app/src
# Default port
EXPOSE 8000
# Run server
CMD ["python", "src/monarch_mcp_custom/server.py"]