graphiti/mcp_server/docker/Dockerfile
Daniel Chalef 299b581bbe
Fix: Enable FalkorDB Browser startup in MCP Server Docker image (#1045)
* Fix: Enable FalkorDB Browser startup in MCP Server Docker image

This fix addresses issue #1041 where the FalkorDB Browser web UI was not
starting automatically in the combined FalkorDB + MCP Server Docker image.

Changes:
- Modified start-services.sh script in Dockerfile to include browser startup logic
- Browser now starts automatically when BROWSER=1 (default behavior)
- Can be disabled by setting BROWSER=0 environment variable
- Browser logs are written to /var/log/graphiti/browser.log
- Added safety checks to verify browser files exist before starting

Updated documentation:
- Added BROWSER environment variable to docker-compose.yml
- Documented BROWSER variable in README-falkordb-combined.md
- Added section explaining how to disable the browser
- Updated architecture diagrams to show browser process

The fix follows the upstream FalkorDB image pattern where the browser
starts with HOSTNAME="0.0.0.0" on port 3000.

Resolves #1041

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

Co-authored-by: Daniel Chalef <danielchalef@users.noreply.github.com>

* Fix: Add missing port 3000 mapping to BROWSER=0 example

The docker run example for disabling the browser was missing the -p 3000:3000
port mapping, which should be included for reference even when BROWSER=0.

Co-authored-by: Daniel Chalef <danielchalef@users.noreply.github.com>

* default to browser enabled

---------

Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Daniel Chalef <danielchalef@users.noreply.github.com>
2025-11-05 11:04:00 -08:00

133 lines
4.2 KiB
Docker

# syntax=docker/dockerfile:1
# Combined FalkorDB + Graphiti MCP Server Image
# This extends the official FalkorDB image to include the MCP server
FROM falkordb/falkordb:latest AS falkordb-base
# Install Python and system dependencies
# Note: Debian Bookworm (FalkorDB base) ships with Python 3.11
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 \
python3-dev \
python3-pip \
curl \
ca-certificates \
procps \
&& 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
# Copy project files for dependency installation
COPY pyproject.toml uv.lock ./
# Remove the local path override for graphiti-core in Docker builds
RUN sed -i '/\[tool\.uv\.sources\]/,/graphiti-core/d' pyproject.toml && \
if [ -n "${GRAPHITI_CORE_VERSION}" ]; then \
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/
# Copy FalkorDB combined config (uses localhost since both services in same container)
COPY config/config-docker-falkordb-combined.yaml /app/mcp/config/config.yaml
# Create log and data directories
RUN mkdir -p /var/log/graphiti /var/lib/falkordb/data
# Create startup script that runs both services
RUN cat > /start-services.sh <<'EOF'
#!/bin/bash
set -e
# Start FalkorDB in background using the correct module path
echo "Starting FalkorDB..."
redis-server \
--loadmodule /var/lib/falkordb/bin/falkordb.so \
--protected-mode no \
--bind 0.0.0.0 \
--port 6379 \
--dir /var/lib/falkordb/data \
--daemonize yes
# Wait for FalkorDB to be ready
echo "Waiting for FalkorDB to be ready..."
until redis-cli -h localhost -p 6379 ping > /dev/null 2>&1; do
echo "FalkorDB not ready yet, waiting..."
sleep 1
done
echo "FalkorDB is ready!"
# Start FalkorDB Browser if enabled (default: enabled)
if [ "${BROWSER:-1}" = "1" ]; then
if [ -d "/var/lib/falkordb/browser" ] && [ -f "/var/lib/falkordb/browser/server.js" ]; then
echo "Starting FalkorDB Browser on port 3000..."
cd /var/lib/falkordb/browser
HOSTNAME="0.0.0.0" node server.js > /var/log/graphiti/browser.log 2>&1 &
echo "FalkorDB Browser started in background"
else
echo "Warning: FalkorDB Browser files not found, skipping browser startup"
fi
else
echo "FalkorDB Browser disabled (BROWSER=${BROWSER})"
fi
# Start MCP server in foreground
echo "Starting MCP server..."
cd /app/mcp
exec /root/.local/bin/uv run main.py
EOF
RUN chmod +x /start-services.sh
# Add Docker labels with version information
ARG MCP_SERVER_VERSION=1.0.0rc0
ARG BUILD_DATE
ARG VCS_REF
LABEL org.opencontainers.image.title="FalkorDB + Graphiti MCP Server" \
org.opencontainers.image.description="Combined FalkorDB graph database with Graphiti MCP server" \
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 ports
EXPOSE 6379 3000 8000
# Health check - verify FalkorDB is responding
# MCP server startup is logged and visible in container output
HEALTHCHECK --interval=10s --timeout=5s --start-period=15s --retries=3 \
CMD redis-cli -p 6379 ping > /dev/null || exit 1
# Override the FalkorDB entrypoint and use our startup script
ENTRYPOINT ["/start-services.sh"]
CMD []