feat: Add standalone Dockerfile for external database deployments
- Create Dockerfile.standalone for MCP server without embedded FalkorDB - Supports both Neo4j and FalkorDB via DATABASE_PROVIDER build arg - Update docker-compose-neo4j.yml to use standalone Dockerfile - Update docker-compose-falkordb.yml to use standalone Dockerfile - Fixes issue where Neo4j compose was starting embedded FalkorDB - Separate images: standalone-neo4j and standalone-falkordb
This commit is contained in:
parent
aff583c400
commit
549ee43fa0
3 changed files with 90 additions and 4 deletions
82
mcp_server/docker/Dockerfile.standalone
Normal file
82
mcp_server/docker/Dockerfile.standalone
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
# syntax=docker/dockerfile:1
|
||||
# Standalone Graphiti MCP Server Image
|
||||
# This image runs only the MCP server and connects to an external database (Neo4j or FalkorDB)
|
||||
|
||||
FROM python:3.11-slim-bookworm
|
||||
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
curl \
|
||||
ca-certificates \
|
||||
&& 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 MCP server directory
|
||||
WORKDIR /app/mcp
|
||||
|
||||
# Accept graphiti-core version as build argument
|
||||
ARG GRAPHITI_CORE_VERSION=0.22.0
|
||||
ARG DATABASE_PROVIDER=neo4j
|
||||
|
||||
# Copy project files for dependency installation
|
||||
COPY pyproject.toml uv.lock ./
|
||||
|
||||
# Remove the local path override for graphiti-core in Docker builds
|
||||
# Install with appropriate database extra
|
||||
RUN sed -i '/\[tool\.uv\.sources\]/,/graphiti-core/d' pyproject.toml && \
|
||||
if [ "${DATABASE_PROVIDER}" = "neo4j" ]; then \
|
||||
sed -i "s/graphiti-core\[falkordb\]>=0\.16\.0/graphiti-core[neo4j]==${GRAPHITI_CORE_VERSION}/" pyproject.toml; \
|
||||
else \
|
||||
sed -i "s/graphiti-core\[falkordb\]>=0\.16\.0/graphiti-core[falkordb]==${GRAPHITI_CORE_VERSION}/" pyproject.toml; \
|
||||
fi
|
||||
|
||||
# Install Python dependencies
|
||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
uv sync --no-dev
|
||||
|
||||
# Store graphiti-core version
|
||||
RUN echo "${GRAPHITI_CORE_VERSION}" > /app/mcp/.graphiti-core-version
|
||||
|
||||
# Copy MCP server application code
|
||||
COPY main.py ./
|
||||
COPY src/ ./src/
|
||||
COPY config/ ./config/
|
||||
|
||||
# Create log directory
|
||||
RUN mkdir -p /var/log/graphiti
|
||||
|
||||
# Add Docker labels with version information
|
||||
ARG MCP_SERVER_VERSION=1.0.0
|
||||
ARG BUILD_DATE
|
||||
ARG VCS_REF
|
||||
LABEL org.opencontainers.image.title="Graphiti MCP Server (Standalone)" \
|
||||
org.opencontainers.image.description="Standalone Graphiti MCP server for external Neo4j or FalkorDB" \
|
||||
org.opencontainers.image.version="${MCP_SERVER_VERSION}" \
|
||||
org.opencontainers.image.created="${BUILD_DATE}" \
|
||||
org.opencontainers.image.revision="${VCS_REF}" \
|
||||
org.opencontainers.image.vendor="Zep AI" \
|
||||
org.opencontainers.image.source="https://github.com/zep-ai/graphiti" \
|
||||
graphiti.core.version="${GRAPHITI_CORE_VERSION}"
|
||||
|
||||
# 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/ || exit 1
|
||||
|
||||
# Run the MCP server
|
||||
CMD ["uv", "run", "main.py"]
|
||||
|
|
@ -16,10 +16,12 @@ services:
|
|||
start_period: 10s
|
||||
|
||||
graphiti-mcp:
|
||||
image: zepai/knowledge-graph-mcp:latest
|
||||
image: zepai/knowledge-graph-mcp:standalone-falkordb
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: docker/Dockerfile
|
||||
dockerfile: docker/Dockerfile.standalone
|
||||
args:
|
||||
DATABASE_PROVIDER: falkordb
|
||||
env_file:
|
||||
- path: ../.env
|
||||
required: false
|
||||
|
|
|
|||
|
|
@ -20,10 +20,12 @@ services:
|
|||
start_period: 30s
|
||||
|
||||
graphiti-mcp:
|
||||
image: zepai/knowledge-graph-mcp:latest
|
||||
image: zepai/knowledge-graph-mcp:standalone-neo4j
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: docker/Dockerfile
|
||||
dockerfile: docker/Dockerfile.standalone
|
||||
args:
|
||||
DATABASE_PROVIDER: neo4j
|
||||
env_file:
|
||||
- path: ../.env
|
||||
required: false
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue