refactor: Unified standalone image with both Neo4j and FalkorDB drivers
- Modified Dockerfile.standalone to install both neo4j and falkordb extras
- Both compose files now use the same standalone image
- Config file determines which database to connect to at runtime
- Added build-standalone.sh script for building and pushing to DockerHub
- Image tags: standalone, {version}-standalone, {version}-graphiti-{core}-standalone
This commit is contained in:
parent
eafa3e4d9e
commit
7dfab2022f
4 changed files with 54 additions and 13 deletions
|
|
@ -29,19 +29,14 @@ WORKDIR /app/mcp
|
||||||
|
|
||||||
# Accept graphiti-core version as build argument
|
# Accept graphiti-core version as build argument
|
||||||
ARG GRAPHITI_CORE_VERSION=0.22.0
|
ARG GRAPHITI_CORE_VERSION=0.22.0
|
||||||
ARG DATABASE_PROVIDER=neo4j
|
|
||||||
|
|
||||||
# Copy project files for dependency installation
|
# Copy project files for dependency installation
|
||||||
COPY pyproject.toml uv.lock ./
|
COPY pyproject.toml uv.lock ./
|
||||||
|
|
||||||
# Remove the local path override for graphiti-core in Docker builds
|
# Remove the local path override for graphiti-core in Docker builds
|
||||||
# Install with appropriate database extra
|
# Install with BOTH neo4j and falkordb extras for maximum flexibility
|
||||||
RUN sed -i '/\[tool\.uv\.sources\]/,/graphiti-core/d' pyproject.toml && \
|
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,falkordb]==${GRAPHITI_CORE_VERSION}/" pyproject.toml
|
||||||
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
|
# Install Python dependencies
|
||||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||||
|
|
|
||||||
50
mcp_server/docker/build-standalone.sh
Executable file
50
mcp_server/docker/build-standalone.sh
Executable file
|
|
@ -0,0 +1,50 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Script to build and push standalone Docker image with both Neo4j and FalkorDB drivers
|
||||||
|
# This script queries PyPI for the latest graphiti-core version and includes it in the image tag
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Get MCP server version from pyproject.toml
|
||||||
|
MCP_VERSION=$(grep '^version = ' ../pyproject.toml | sed 's/version = "\(.*\)"/\1/')
|
||||||
|
|
||||||
|
# Get latest graphiti-core version from PyPI
|
||||||
|
echo "Querying PyPI for latest graphiti-core version..."
|
||||||
|
GRAPHITI_CORE_VERSION=$(curl -s https://pypi.org/pypi/graphiti-core/json | python3 -c "import sys, json; print(json.load(sys.stdin)['info']['version'])")
|
||||||
|
echo "Latest graphiti-core version: ${GRAPHITI_CORE_VERSION}"
|
||||||
|
|
||||||
|
# Get build metadata
|
||||||
|
BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
||||||
|
VCS_REF=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")
|
||||||
|
|
||||||
|
# Build the standalone image with explicit graphiti-core version
|
||||||
|
echo "Building standalone Docker image..."
|
||||||
|
docker build \
|
||||||
|
--build-arg MCP_SERVER_VERSION="${MCP_VERSION}" \
|
||||||
|
--build-arg GRAPHITI_CORE_VERSION="${GRAPHITI_CORE_VERSION}" \
|
||||||
|
--build-arg BUILD_DATE="${BUILD_DATE}" \
|
||||||
|
--build-arg VCS_REF="${VCS_REF}" \
|
||||||
|
-f Dockerfile.standalone \
|
||||||
|
-t "zepai/knowledge-graph-mcp:standalone" \
|
||||||
|
-t "zepai/knowledge-graph-mcp:${MCP_VERSION}-standalone" \
|
||||||
|
-t "zepai/knowledge-graph-mcp:${MCP_VERSION}-graphiti-${GRAPHITI_CORE_VERSION}-standalone" \
|
||||||
|
..
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Build complete!"
|
||||||
|
echo " MCP Server Version: ${MCP_VERSION}"
|
||||||
|
echo " Graphiti Core Version: ${GRAPHITI_CORE_VERSION}"
|
||||||
|
echo " Build Date: ${BUILD_DATE}"
|
||||||
|
echo " VCS Ref: ${VCS_REF}"
|
||||||
|
echo ""
|
||||||
|
echo "Image tags:"
|
||||||
|
echo " - zepai/knowledge-graph-mcp:standalone"
|
||||||
|
echo " - zepai/knowledge-graph-mcp:${MCP_VERSION}-standalone"
|
||||||
|
echo " - zepai/knowledge-graph-mcp:${MCP_VERSION}-graphiti-${GRAPHITI_CORE_VERSION}-standalone"
|
||||||
|
echo ""
|
||||||
|
echo "To push to DockerHub:"
|
||||||
|
echo " docker push zepai/knowledge-graph-mcp:standalone"
|
||||||
|
echo " docker push zepai/knowledge-graph-mcp:${MCP_VERSION}-standalone"
|
||||||
|
echo " docker push zepai/knowledge-graph-mcp:${MCP_VERSION}-graphiti-${GRAPHITI_CORE_VERSION}-standalone"
|
||||||
|
echo ""
|
||||||
|
echo "Or push all tags:"
|
||||||
|
echo " docker push --all-tags zepai/knowledge-graph-mcp"
|
||||||
|
|
@ -16,12 +16,10 @@ services:
|
||||||
start_period: 10s
|
start_period: 10s
|
||||||
|
|
||||||
graphiti-mcp:
|
graphiti-mcp:
|
||||||
image: zepai/knowledge-graph-mcp:standalone-falkordb
|
image: zepai/knowledge-graph-mcp:standalone
|
||||||
build:
|
build:
|
||||||
context: ..
|
context: ..
|
||||||
dockerfile: docker/Dockerfile.standalone
|
dockerfile: docker/Dockerfile.standalone
|
||||||
args:
|
|
||||||
DATABASE_PROVIDER: falkordb
|
|
||||||
env_file:
|
env_file:
|
||||||
- path: ../.env
|
- path: ../.env
|
||||||
required: false
|
required: false
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,10 @@ services:
|
||||||
start_period: 30s
|
start_period: 30s
|
||||||
|
|
||||||
graphiti-mcp:
|
graphiti-mcp:
|
||||||
image: zepai/knowledge-graph-mcp:standalone-neo4j
|
image: zepai/knowledge-graph-mcp:standalone
|
||||||
build:
|
build:
|
||||||
context: ..
|
context: ..
|
||||||
dockerfile: docker/Dockerfile.standalone
|
dockerfile: docker/Dockerfile.standalone
|
||||||
args:
|
|
||||||
DATABASE_PROVIDER: neo4j
|
|
||||||
env_file:
|
env_file:
|
||||||
- path: ../.env
|
- path: ../.env
|
||||||
required: false
|
required: false
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue