Compare commits
3 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
259e697d2f | ||
|
|
c1d67c9437 | ||
|
|
70200c742a |
4 changed files with 3409 additions and 3215 deletions
|
|
@ -26,20 +26,19 @@ RUN apt-get update && apt-get install -y \
|
||||||
build-essential \
|
build-essential \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Copy pyproject.toml and lockfile first for better caching
|
# Copy main cognee project first (required dependency for cognee-mcp)
|
||||||
COPY ./cognee-mcp/pyproject.toml ./cognee-mcp/uv.lock ./cognee-mcp/entrypoint.sh ./
|
COPY pyproject.toml uv.lock ./
|
||||||
|
COPY cognee/ ./cognee/
|
||||||
# Install the project's dependencies using the lockfile and settings
|
|
||||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
||||||
uv sync --frozen --no-install-project --no-dev --no-editable
|
|
||||||
|
|
||||||
# Copy Alembic configuration
|
# Copy Alembic configuration
|
||||||
COPY alembic.ini /app/alembic.ini
|
COPY alembic.ini /app/alembic.ini
|
||||||
COPY alembic/ /app/alembic
|
COPY alembic/ /app/alembic
|
||||||
|
|
||||||
# Then, add the rest of the project source code and install it
|
# Copy cognee-mcp project files
|
||||||
# Installing separately from its dependencies allows optimal layer caching
|
COPY ./cognee-mcp/pyproject.toml ./cognee-mcp/uv.lock ./cognee-mcp/entrypoint.sh ./
|
||||||
COPY ./cognee-mcp /app
|
COPY ./cognee-mcp /app
|
||||||
|
|
||||||
|
# Install the project's dependencies using the lockfile and settings
|
||||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||||
uv sync --frozen --no-dev --no-editable
|
uv sync --frozen --no-dev --no-editable
|
||||||
|
|
||||||
|
|
@ -51,7 +50,6 @@ RUN apt-get update && apt-get install -y \
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY --from=uv /root/.local /root/.local
|
|
||||||
COPY --from=uv /app /app
|
COPY --from=uv /app /app
|
||||||
|
|
||||||
RUN chmod +x /app/entrypoint.sh
|
RUN chmod +x /app/entrypoint.sh
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,14 @@ echo "HTTP port: $HTTP_PORT"
|
||||||
# smooth redeployments and container restarts while maintaining data integrity.
|
# smooth redeployments and container restarts while maintaining data integrity.
|
||||||
echo "Running database migrations..."
|
echo "Running database migrations..."
|
||||||
|
|
||||||
MIGRATION_OUTPUT=$(alembic upgrade head)
|
# Detect if we're in Docker (alembic.ini in /app) or local (alembic.ini in parent dir)
|
||||||
|
if [ -f "/app/alembic.ini" ]; then
|
||||||
|
MIGRATION_OUTPUT=$(alembic -c /app/alembic.ini upgrade head 2>&1)
|
||||||
|
else
|
||||||
|
# Local execution - change to cognee root directory where alembic.ini exists
|
||||||
|
cd "$(dirname "$0")/.."
|
||||||
|
MIGRATION_OUTPUT=$(alembic upgrade head 2>&1)
|
||||||
|
fi
|
||||||
MIGRATION_EXIT_CODE=$?
|
MIGRATION_EXIT_CODE=$?
|
||||||
|
|
||||||
if [[ $MIGRATION_EXIT_CODE -ne 0 ]]; then
|
if [[ $MIGRATION_EXIT_CODE -ne 0 ]]; then
|
||||||
|
|
|
||||||
|
|
@ -786,12 +786,24 @@ async def main():
|
||||||
|
|
||||||
# Run Alembic migrations from the main cognee directory where alembic.ini is located
|
# Run Alembic migrations from the main cognee directory where alembic.ini is located
|
||||||
print("Running database migrations...")
|
print("Running database migrations...")
|
||||||
migration_result = subprocess.run(
|
|
||||||
["python", "-m", "alembic", "upgrade", "head"],
|
# Detect if we're in Docker (alembic.ini in /app) or local (alembic.ini in parent dir)
|
||||||
capture_output=True,
|
if os.path.exists("/app/alembic.ini"):
|
||||||
text=True,
|
# Docker environment - use explicit config path
|
||||||
cwd=Path(__file__).resolve().parent.parent.parent,
|
migration_result = subprocess.run(
|
||||||
)
|
["python", "-m", "alembic", "-c", "/app/alembic.ini", "upgrade", "head"],
|
||||||
|
capture_output=True,
|
||||||
|
text=True,
|
||||||
|
cwd="/app",
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
# Local environment - use relative path
|
||||||
|
migration_result = subprocess.run(
|
||||||
|
["python", "-m", "alembic", "upgrade", "head"],
|
||||||
|
capture_output=True,
|
||||||
|
text=True,
|
||||||
|
cwd=Path(__file__).resolve().parent.parent.parent,
|
||||||
|
)
|
||||||
|
|
||||||
if migration_result.returncode != 0:
|
if migration_result.returncode != 0:
|
||||||
migration_output = migration_result.stderr + migration_result.stdout
|
migration_output = migration_result.stderr + migration_result.stdout
|
||||||
|
|
|
||||||
6575
cognee-mcp/uv.lock
generated
6575
cognee-mcp/uv.lock
generated
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue