Files
monarch-mcp-custom/Dockerfile
Ben 1e8d484389
All checks were successful
Build and Push Monarch MCP Docker Image / build (push) Successful in 16s
fix: copy src directory before pip install
Dockerfile was failing because we tried to install in editable mode
before copying the src directory. Copy src/ first so that uv can
find the package structure properly.
2025-12-24 21:42:24 +00:00

45 lines
999 B
Docker

# Stage 1: Builder
FROM python:3.12-slim AS builder
WORKDIR /app
# Install uv for fast dependency management
RUN 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"]