-
Notifications
You must be signed in to change notification settings - Fork 966
fix: cognee docker image #820
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
efbde14
f0ac09f
9d96b5a
d189aeb
2b57d8c
00de4bf
85d2391
cd72204
92cab9c
f68e966
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,60 +1,61 @@ | ||
| FROM python:3.11-slim | ||
|
|
||
| # Define Poetry extras to install | ||
| ARG POETRY_EXTRAS="\ | ||
| # API \ | ||
| api \ | ||
| # Storage & Databases \ | ||
| postgres weaviate qdrant neo4j falkordb milvus kuzu chromadb \ | ||
| # Notebooks & Interactive Environments \ | ||
| notebook \ | ||
| # LLM & AI Frameworks \ | ||
| langchain llama-index gemini huggingface ollama mistral groq anthropic \ | ||
| # Evaluation & Monitoring \ | ||
| deepeval evals posthog \ | ||
| # Graph Processing & Code Analysis \ | ||
| codegraph graphiti \ | ||
| # Document Processing \ | ||
| docs" | ||
| # Use a Python image with uv pre-installed | ||
| FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS uv | ||
|
|
||
| # Install the project into `/app` | ||
| WORKDIR /app | ||
|
|
||
| # Enable bytecode compilation | ||
| # ENV UV_COMPILE_BYTECODE=1 | ||
|
|
||
| # Copy from the cache instead of linking since it's a mounted volume | ||
| ENV UV_LINK_MODE=copy | ||
|
|
||
| # Set build argument | ||
| ARG DEBUG | ||
|
|
||
| # Set environment variable based on the build argument | ||
| ENV DEBUG=${DEBUG} | ||
| ENV PIP_NO_CACHE_DIR=true | ||
| ENV PATH="${PATH}:/root/.poetry/bin" | ||
|
|
||
| RUN apt-get update | ||
| # Install system dependencies | ||
| RUN apt-get update && apt-get install -y \ | ||
| gcc \ | ||
| libpq-dev \ | ||
| git \ | ||
| curl \ | ||
| clang \ | ||
| build-essential \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| RUN apt-get install -y \ | ||
| gcc \ | ||
| build-essential \ | ||
| libpq-dev | ||
| # Copy pyproject.toml and lockfile first for better caching | ||
| COPY README.md pyproject.toml uv.lock entrypoint.sh ./ | ||
|
|
||
| WORKDIR /app | ||
| COPY pyproject.toml poetry.lock /app/ | ||
|
|
||
| RUN pip install poetry | ||
| # Install the project's dependencies using the lockfile and settings | ||
| RUN --mount=type=cache,target=/root/.cache/uv \ | ||
| uv sync --extra debug --extra api --extra postgres --extra weaviate --extra qdrant --extra neo4j --extra kuzu --extra llama-index --extra gemini --extra ollama --extra mistral --extra groq --extra anthropic --frozen --no-install-project --no-dev --no-editable | ||
|
|
||
| # Don't create virtualenv since Docker is already isolated | ||
| RUN poetry config virtualenvs.create false | ||
| # Copy Alembic configuration | ||
| COPY alembic.ini /app/alembic.ini | ||
| COPY alembic/ /app/alembic | ||
|
|
||
| # Install the dependencies using the defined extras | ||
| RUN poetry install --extras "${POETRY_EXTRAS}" --no-root | ||
| # Then, add the rest of the project source code and install it | ||
| # Installing separately from its dependencies allows optimal layer caching | ||
| COPY ./cognee /app/cognee | ||
| RUN --mount=type=cache,target=/root/.cache/uv \ | ||
| uv sync --extra debug --extra api --extra postgres --extra weaviate --extra qdrant --extra neo4j --extra kuzu --extra llama-index --extra gemini --extra ollama --extra mistral --extra groq --extra anthropic --frozen --no-dev --no-editable | ||
|
|
||
| # Set the PYTHONPATH environment variable to include the /app directory | ||
| ENV PYTHONPATH=/app | ||
| FROM python:3.12-slim-bookworm | ||
|
|
||
| COPY cognee/ /app/cognee | ||
| WORKDIR /app | ||
|
|
||
| # Copy Alembic configuration | ||
| COPY alembic.ini /app/alembic.ini | ||
| COPY alembic/ /app/alembic | ||
| COPY --from=uv /app /app | ||
| # COPY --from=uv /app/.venv /app/.venv | ||
| # COPY --from=uv /root/.local /root/.local | ||
|
|
||
| COPY entrypoint.sh /app/entrypoint.sh | ||
| RUN chmod +x /app/entrypoint.sh | ||
|
|
||
| RUN sed -i 's/\r$//' /app/entrypoint.sh | ||
| # Place executables in the environment at the front of the path | ||
| ENV PATH="/app/.venv/bin:$PATH" | ||
|
|
||
| ENV PYTHONPATH=/app | ||
|
|
||
| ENTRYPOINT ["/app/entrypoint.sh"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,13 @@ | ||
| import { fetch } from '@/utils'; | ||
|
|
||
| export default function cognifyDataset(dataset: { id: string, name: string }) { | ||
| export default function cognifyDataset(dataset: { id?: string, name?: string }) { | ||
| return fetch('/v1/cognify', { | ||
| method: 'POST', | ||
| headers: { | ||
| 'Content-Type': 'application/json', | ||
| }, | ||
| body: JSON.stringify({ | ||
| datasets: [dataset.id], | ||
| datasets: [dataset.id || dataset.name], | ||
| }), | ||
| }).then((response) => response.json()); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -144,7 +144,9 @@ async def cognify_status(): | |
| """Get status of cognify pipeline""" | ||
| with redirect_stdout(sys.stderr): | ||
| user = await get_default_user() | ||
| status = await get_pipeline_status([await get_unique_dataset_id("main_dataset", user)]) | ||
| status = await get_pipeline_status( | ||
| [await get_unique_dataset_id("main_dataset", user)], "cognify_pipeline" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about the add pipeline status? That also needs to be checked along with cognify for Cognee-mcp cognify
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When both are complete the status should be complete and if the add pipeline is working status needs to be processing
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What would happen now if the user would check the status while the add pipeline is running?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In mcp
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the users check right away I it will most likely happen, which is pretty realistic for them to do. Would be great to treat the return status as one pipeline then as well by checking state of both and handling the return based on combined states (or something like this)
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extension of scope or unclear scope, let's create a ticket for this one and merge with existing functionality |
||
| ) | ||
| return [types.TextContent(type="text", text=str(status))] | ||
|
|
||
|
|
||
|
|
@@ -153,7 +155,9 @@ async def codify_status(): | |
| """Get status of codify pipeline""" | ||
| with redirect_stdout(sys.stderr): | ||
| user = await get_default_user() | ||
| status = await get_pipeline_status([await get_unique_dataset_id("codebase", user)]) | ||
| status = await get_pipeline_status( | ||
| [await get_unique_dataset_id("codebase", user)], "cognify_code_pipeline" | ||
| ) | ||
| return [types.TextContent(type="text", text=str(status))] | ||
|
|
||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be good to define the Dockerfile used extras at the beginning of the Dockerfile like before, it will make it easier for updating/maintaining later on. Especially since extras are now called in two different places in the Dockerfile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't pass all extras at once, like we did with poetry. Here we have to pass one by one, so I would have to iterate somehow through extras and add each separately. I don't want to spend time on that now, we can change it later.