diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..d2d26277f --- /dev/null +++ b/.dockerignore @@ -0,0 +1,16 @@ +bin +dist +docs +evals +tests +tools +assets +notebooks +cognee-frontend + +.dlt +.venv +.github + +.idea +.vscode diff --git a/Dockerfile b/Dockerfile index f8c3adfed..49ae2e45d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,7 +26,6 @@ RUN apt-get update -q && \ curl \ zip \ jq \ -# libgl1-mesa-glx \ netcat-traditional && \ pip install poetry && \ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \ diff --git a/Dockerfile-vanilla b/Dockerfile-vanilla new file mode 100644 index 000000000..30a2019dc --- /dev/null +++ b/Dockerfile-vanilla @@ -0,0 +1,30 @@ +FROM python:3.11-slim + +# 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" + +WORKDIR /app +COPY pyproject.toml poetry.lock /app/ + +RUN pip install poetry + +# Create virtualenv +RUN poetry config virtualenvs.create false + +# Install the dependencies +RUN poetry install --no-root --no-dev + +# Set the PYTHONPATH environment variable to include the /app directory +ENV PYTHONPATH=/app + +COPY cognee/ /app/cognee + +COPY entrypoint-vanilla.sh /app/entrypoint-vanilla.sh +RUN chmod +x /app/entrypoint-vanilla.sh + +ENTRYPOINT ["/app/entrypoint-vanilla.sh"] diff --git a/docker-compose-vanilla.yml b/docker-compose-vanilla.yml new file mode 100644 index 000000000..7a79e622b --- /dev/null +++ b/docker-compose-vanilla.yml @@ -0,0 +1,39 @@ +services: + cognee: + container_name: cognee + networks: + - cognee-network + build: + context: . + dockerfile: Dockerfile-vanilla + volumes: + - .:/app + - /app/cognee-frontend/ + environment: + - HOST=0.0.0.0 + - ENVIRONMENT=local + - PYTHONPATH=. + ports: + - 8000:8000 + - 5678:5678 # Debugging + deploy: + resources: + limits: + cpus: "4.0" + memory: 8GB + + frontend: + container_name: frontend + build: + context: ./cognee-frontend + dockerfile: Dockerfile + volumes: + - "./cognee-frontend:/app" + ports: + - "3000:3000" + networks: + - cognee-network + +networks: + cognee-network: + name: cognee-network diff --git a/docker-compose.yml b/docker-compose.yml index 4ba2227a8..d706d0316 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,14 +26,12 @@ services: - HOST=0.0.0.0 - ENVIRONMENT=local - PYTHONPATH=. - profiles: ["exclude-from-up"] ports: - 8000:8000 - 443:443 - 80:80 - 50051:50051 - - 5678:5678 -# - 5432:5432 + - 5678:5678 # Debugging depends_on: - postgres - neo4j diff --git a/entrypoint-vanilla.sh b/entrypoint-vanilla.sh new file mode 100755 index 000000000..ed8b4780a --- /dev/null +++ b/entrypoint-vanilla.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +echo "Debug mode: $DEBUG" +echo "Environment: $ENVIRONMENT" + +echo "Starting Gunicorn" + +if [ "$ENVIRONMENT" = "local" ]; then + if [ "$DEBUG" = true ]; then + echo "Waiting for the debugger to attach..." + + python -m debugpy --wait-for-client --listen 0.0.0.0:5678 -m gunicorn -w 3 -k uvicorn.workers.UvicornWorker -t 30000 --bind=0.0.0.0:8000 --log-level debug --reload cognee.api.client:app + else + gunicorn -w 3 -k uvicorn.workers.UvicornWorker -t 30000 --bind=0.0.0.0:8000 --log-level debug --reload cognee.api.client:app + fi +else + gunicorn -w 3 -k uvicorn.workers.UvicornWorker -t 30000 --bind=0.0.0.0:8000 --log-level error cognee.api.client:app +fi diff --git a/poetry.lock b/poetry.lock index 92bf8830f..dd4f35d25 100644 --- a/poetry.lock +++ b/poetry.lock @@ -8314,14 +8314,13 @@ test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools", cli = [] duckdb = ["duckdb"] filesystem = [] -motherduck = ["duckdb", "pyarrow"] +motherduck = ["duckdb"] neo4j = ["neo4j"] notebook = ["overrides"] -parquet = ["pyarrow"] qdrant = ["qdrant-client"] weaviate = ["weaviate-client"] [metadata] lock-version = "2.0" python-versions = ">=3.9.0,<3.12" -content-hash = "0d47b955224bb4f7d52815e63d15b2230dcff86f91a4f79b5533c299f965018b" +content-hash = "3e894bd32ee1d47a344ad4325731c064271b687b1f6af3c820436dc27f9d06a1" diff --git a/pyproject.toml b/pyproject.toml index 0b47a792d..ce4f2088d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,7 +30,7 @@ sqlalchemy = "^2.0.21" instructor = "1.2.1" networkx = "^3.2.1" debugpy = "^1.8.0" -pyarrow = "^15.0.0" +pyarrow = "15.0.0" pylint = "^3.0.3" aiosqlite = "^0.20.0" pandas = "2.0.3" @@ -75,12 +75,10 @@ anthropic = "^0.26.1" langchain-text-splitters = "^0.2.1" - [tool.poetry.extras] -parquet = ["pyarrow"] duckdb = ["duckdb"] filesystem = ["s3fs", "botocore"] -motherduck = ["duckdb", "pyarrow"] +motherduck = ["duckdb"] cli = ["pipdeptree", "cron-descriptor"] weaviate = ["weaviate-client"] qdrant = ["qdrant-client"]