78 lines
2.4 KiB
Text
78 lines
2.4 KiB
Text
# syntax=docker/dockerfile:1
|
|
# Custom Graphiti MCP Server Image with Local graphiti-core Changes
|
|
# This Dockerfile builds the MCP server using the LOCAL graphiti-core code
|
|
# instead of pulling from PyPI
|
|
|
|
FROM python:3.11-slim-bookworm
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
curl \
|
|
ca-certificates \
|
|
git \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install uv for Python package management
|
|
ADD https://astral.sh/uv/install.sh /uv-installer.sh
|
|
RUN sh /uv-installer.sh && rm /uv-installer.sh
|
|
|
|
# Add uv to PATH
|
|
ENV PATH="/root/.local/bin:${PATH}"
|
|
|
|
# Configure uv for optimal Docker usage
|
|
ENV UV_COMPILE_BYTECODE=1 \
|
|
UV_LINK_MODE=copy \
|
|
UV_PYTHON_DOWNLOADS=never \
|
|
MCP_SERVER_HOST="0.0.0.0" \
|
|
PYTHONUNBUFFERED=1
|
|
|
|
# Set up application directory
|
|
WORKDIR /app
|
|
|
|
# Copy the ENTIRE graphiti project (both core and mcp_server)
|
|
# This allows us to use the local graphiti-core
|
|
COPY . /app
|
|
|
|
# Build and install graphiti-core from local source first
|
|
WORKDIR /app
|
|
RUN uv pip install --system "./[neo4j,falkordb]"
|
|
|
|
# Now set up MCP server
|
|
WORKDIR /app/mcp_server
|
|
|
|
# Install MCP server dependencies (graphiti-core already installed from local)
|
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
uv sync --no-dev
|
|
|
|
# Accept version build arguments
|
|
ARG GRAPHITI_CORE_VERSION=local
|
|
ARG MCP_SERVER_VERSION=1.0.0
|
|
ARG BUILD_DATE
|
|
ARG VCS_REF
|
|
|
|
# Store version info
|
|
RUN echo "${GRAPHITI_CORE_VERSION}" > /app/mcp_server/.graphiti-core-version
|
|
|
|
# Create log directory
|
|
RUN mkdir -p /var/log/graphiti
|
|
|
|
# Add Docker labels with version information
|
|
LABEL org.opencontainers.image.title="Graphiti MCP Server (Custom Build)" \
|
|
org.opencontainers.image.description="Custom Graphiti MCP server with local graphiti-core changes" \
|
|
org.opencontainers.image.version="${MCP_SERVER_VERSION}" \
|
|
org.opencontainers.image.created="${BUILD_DATE}" \
|
|
org.opencontainers.image.revision="${VCS_REF}" \
|
|
org.opencontainers.image.vendor="Custom Build" \
|
|
org.opencontainers.image.source="https://github.com/lvarming/graphiti" \
|
|
graphiti.core.version="${GRAPHITI_CORE_VERSION}" \
|
|
graphiti.core.source="local"
|
|
|
|
# Expose MCP server port
|
|
EXPOSE 8000
|
|
|
|
# Health check - verify MCP server is responding
|
|
HEALTHCHECK --interval=10s --timeout=5s --start-period=15s --retries=3 \
|
|
CMD curl -f http://localhost:8000/health || exit 1
|
|
|
|
# Run the MCP server
|
|
CMD ["uv", "run", "main.py"]
|