Fix dependency installation order and optimize FalkorDB install

Address additional review concerns:

1. **Fix dependency installation order** - Install server deps first with uv sync, then upgrade graphiti-core to desired PyPI version using --upgrade flag. This prevents stale uv.lock (pinned to 0.13.2) from downgrading our target version.

2. **Optimize FalkorDB installation** - Combine graphiti-core installation with FalkorDB extra in single command, avoiding redundant package reinstall.

3. **Add --upgrade flag** - Ensures the specific PyPI version takes precedence over lockfile version.

The installation sequence is now:
- uv sync (server deps + graphiti-core 0.13.2 from lock)
- uv pip install --upgrade graphiti-core==TARGET_VERSION (upgrades to desired version)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Daniel Chalef 2025-10-29 19:18:45 -07:00
parent 6215b6d7d7
commit 4155b37626

View file

@ -35,32 +35,28 @@ ENV UV_COMPILE_BYTECODE=1 \
# Create non-root user
RUN groupadd -r app && useradd -r -d /app -g app app
# Install graphiti-core from PyPI
# If GRAPHITI_VERSION is provided, install that specific version; otherwise install latest
RUN --mount=type=cache,target=/root/.cache/uv \
if [ -n "$GRAPHITI_VERSION" ]; then \
uv pip install --system "graphiti-core==$GRAPHITI_VERSION"; \
else \
uv pip install --system graphiti-core; \
fi
# Set up the server application
# Set up the server application first
WORKDIR /app
COPY ./server/pyproject.toml ./server/README.md ./server/uv.lock ./
COPY ./server/graph_service ./graph_service
# Install server dependencies and application
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-dev
# Install falkordb if requested
# Install server dependencies (without graphiti-core from lockfile)
# Then install graphiti-core from PyPI at the desired version
# This prevents the stale lockfile from pinning an old graphiti-core version
ARG INSTALL_FALKORDB=false
RUN --mount=type=cache,target=/root/.cache/uv \
if [ "$INSTALL_FALKORDB" = "true" ]; then \
if [ -n "$GRAPHITI_VERSION" ]; then \
uv pip install --system "graphiti-core[falkordb]==$GRAPHITI_VERSION"; \
uv sync --frozen --no-dev && \
if [ -n "$GRAPHITI_VERSION" ]; then \
if [ "$INSTALL_FALKORDB" = "true" ]; then \
uv pip install --system --upgrade "graphiti-core[falkordb]==$GRAPHITI_VERSION"; \
else \
uv pip install --system "graphiti-core[falkordb]"; \
uv pip install --system --upgrade "graphiti-core==$GRAPHITI_VERSION"; \
fi; \
else \
if [ "$INSTALL_FALKORDB" = "true" ]; then \
uv pip install --system --upgrade "graphiti-core[falkordb]"; \
else \
uv pip install --system --upgrade graphiti-core; \
fi; \
fi