conductor-checkpoint-msg_01P7ur6mQEusfHTYpBrBnpk3

This commit is contained in:
Daniel Chalef 2025-10-30 07:50:07 -07:00
parent 517682ec36
commit e8a360e5cf
3 changed files with 28 additions and 37 deletions

View file

@ -54,6 +54,14 @@ jobs:
- name: Set up Depot CLI
uses: depot/setup-action@v1
- name: Get latest graphiti-core version from PyPI
id: graphiti
run: |
# Query PyPI for the latest graphiti-core version
GRAPHITI_VERSION=$(curl -s https://pypi.org/pypi/graphiti-core/json | python -c "import sys, json; print(json.load(sys.stdin)['info']['version'])")
echo "graphiti_version=${GRAPHITI_VERSION}" >> $GITHUB_OUTPUT
echo "Latest Graphiti Core version from PyPI: ${GRAPHITI_VERSION}"
- name: Extract metadata
id: meta
run: |
@ -61,28 +69,6 @@ jobs:
echo "build_date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_OUTPUT
echo "vcs_ref=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
- name: Build Docker image (temp for version extraction)
uses: depot/build-push-action@v1
with:
project: v9jv1mlpwc
context: ./mcp_server
platforms: linux/amd64
push: false
load: true
tags: temp-image:latest
build-args: |
MCP_SERVER_VERSION=${{ steps.version.outputs.version }}
BUILD_DATE=${{ steps.meta.outputs.build_date }}
VCS_REF=${{ steps.meta.outputs.vcs_ref }}
- name: Extract Graphiti Core version
id: graphiti
run: |
# Extract graphiti-core version from the built image
GRAPHITI_VERSION=$(docker run --rm temp-image:latest cat /app/.graphiti-core-version)
echo "graphiti_version=${GRAPHITI_VERSION}" >> $GITHUB_OUTPUT
echo "Graphiti Core Version: ${GRAPHITI_VERSION}"
- name: Generate Docker metadata
id: docker_meta
uses: docker/metadata-action@v5
@ -110,6 +96,7 @@ jobs:
labels: ${{ steps.docker_meta.outputs.labels }}
build-args: |
MCP_SERVER_VERSION=${{ steps.version.outputs.version }}
GRAPHITI_CORE_VERSION=${{ steps.graphiti.outputs.graphiti_version }}
BUILD_DATE=${{ steps.meta.outputs.build_date }}
VCS_REF=${{ steps.meta.outputs.vcs_ref }}

View file

@ -26,19 +26,23 @@ ENV UV_COMPILE_BYTECODE=1 \
# Create non-root user
RUN groupadd -r app && useradd -r -d /app -g app app
# Accept graphiti-core version as build argument
ARG GRAPHITI_CORE_VERSION
# Copy project files for dependency installation (better caching)
COPY pyproject.toml uv.lock ./
# Remove the local path override for graphiti-core in Docker builds
# This allows uv to use the published package from PyPI
RUN sed -i '/\[tool\.uv\.sources\]/,/graphiti-core/d' pyproject.toml
# Remove the local path override and version constraint for graphiti-core in Docker builds
# This allows us to pin to a specific version passed as a build arg
RUN sed -i '/\[tool\.uv\.sources\]/,/graphiti-core/d' pyproject.toml && \
sed -i 's/graphiti-core\[kuzu,falkordb\]>=0\.16\.0/graphiti-core[kuzu,falkordb]==${GRAPHITI_CORE_VERSION}/' pyproject.toml
# Install dependencies first (better layer caching)
# Install dependencies with explicit graphiti-core version
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --no-dev
# Extract graphiti-core version and store it in a file for runtime access
RUN uv pip freeze | grep graphiti-core | cut -d'=' -f3 > /app/.graphiti-core-version
# Store graphiti-core version in a file for runtime access
RUN echo "${GRAPHITI_CORE_VERSION}" > /app/.graphiti-core-version
# Copy application code and configuration
COPY main.py ./

View file

@ -1,30 +1,34 @@
#!/bin/bash
# Script to build Docker image with proper version tagging
# This script extracts the graphiti-core version and includes it in the image tag
# 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 image
# Build the image with explicit graphiti-core version
echo "Building 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 \
-t "zepai/graphiti-mcp:${MCP_VERSION}" \
-t "zepai/graphiti-mcp:${MCP_VERSION}-graphiti-${GRAPHITI_CORE_VERSION}" \
-t "zepai/graphiti-mcp:latest" \
..
# Extract graphiti-core version from the built image
GRAPHITI_CORE_VERSION=$(docker run --rm "zepai/graphiti-mcp:${MCP_VERSION}" cat /app/.graphiti-core-version)
echo ""
echo "Build complete!"
echo " MCP Server Version: ${MCP_VERSION}"
@ -36,10 +40,6 @@ echo "Image tags:"
echo " - zepai/graphiti-mcp:${MCP_VERSION}"
echo " - zepai/graphiti-mcp:${MCP_VERSION}-graphiti-${GRAPHITI_CORE_VERSION}"
echo " - zepai/graphiti-mcp:latest"
# Tag with graphiti-core version
docker tag "zepai/graphiti-mcp:${MCP_VERSION}" "zepai/graphiti-mcp:${MCP_VERSION}-graphiti-${GRAPHITI_CORE_VERSION}"
echo ""
echo "To inspect image metadata:"
echo " docker inspect zepai/graphiti-mcp:${MCP_VERSION} | jq '.[0].Config.Labels'"