chore: add vanilla docker config

This commit is contained in:
Boris Arzentar 2024-06-23 00:36:34 +02:00
parent 79d299eedd
commit cb64ab14fa
8 changed files with 108 additions and 11 deletions

16
.dockerignore Normal file
View file

@ -0,0 +1,16 @@
bin
dist
docs
evals
tests
tools
assets
notebooks
cognee-frontend
.dlt
.venv
.github
.idea
.vscode

View file

@ -26,7 +26,6 @@ RUN apt-get update -q && \
curl \ curl \
zip \ zip \
jq \ jq \
# libgl1-mesa-glx \
netcat-traditional && \ netcat-traditional && \
pip install poetry && \ pip install poetry && \
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \

30
Dockerfile-vanilla Normal file
View file

@ -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"]

View file

@ -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

View file

@ -26,14 +26,12 @@ services:
- HOST=0.0.0.0 - HOST=0.0.0.0
- ENVIRONMENT=local - ENVIRONMENT=local
- PYTHONPATH=. - PYTHONPATH=.
profiles: ["exclude-from-up"]
ports: ports:
- 8000:8000 - 8000:8000
- 443:443 - 443:443
- 80:80 - 80:80
- 50051:50051 - 50051:50051
- 5678:5678 - 5678:5678 # Debugging
# - 5432:5432
depends_on: depends_on:
- postgres - postgres
- neo4j - neo4j

18
entrypoint-vanilla.sh Executable file
View file

@ -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

5
poetry.lock generated
View file

@ -8314,14 +8314,13 @@ test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools",
cli = [] cli = []
duckdb = ["duckdb"] duckdb = ["duckdb"]
filesystem = [] filesystem = []
motherduck = ["duckdb", "pyarrow"] motherduck = ["duckdb"]
neo4j = ["neo4j"] neo4j = ["neo4j"]
notebook = ["overrides"] notebook = ["overrides"]
parquet = ["pyarrow"]
qdrant = ["qdrant-client"] qdrant = ["qdrant-client"]
weaviate = ["weaviate-client"] weaviate = ["weaviate-client"]
[metadata] [metadata]
lock-version = "2.0" lock-version = "2.0"
python-versions = ">=3.9.0,<3.12" python-versions = ">=3.9.0,<3.12"
content-hash = "0d47b955224bb4f7d52815e63d15b2230dcff86f91a4f79b5533c299f965018b" content-hash = "3e894bd32ee1d47a344ad4325731c064271b687b1f6af3c820436dc27f9d06a1"

View file

@ -30,7 +30,7 @@ sqlalchemy = "^2.0.21"
instructor = "1.2.1" instructor = "1.2.1"
networkx = "^3.2.1" networkx = "^3.2.1"
debugpy = "^1.8.0" debugpy = "^1.8.0"
pyarrow = "^15.0.0" pyarrow = "15.0.0"
pylint = "^3.0.3" pylint = "^3.0.3"
aiosqlite = "^0.20.0" aiosqlite = "^0.20.0"
pandas = "2.0.3" pandas = "2.0.3"
@ -75,12 +75,10 @@ anthropic = "^0.26.1"
langchain-text-splitters = "^0.2.1" langchain-text-splitters = "^0.2.1"
[tool.poetry.extras] [tool.poetry.extras]
parquet = ["pyarrow"]
duckdb = ["duckdb"] duckdb = ["duckdb"]
filesystem = ["s3fs", "botocore"] filesystem = ["s3fs", "botocore"]
motherduck = ["duckdb", "pyarrow"] motherduck = ["duckdb"]
cli = ["pipdeptree", "cron-descriptor"] cli = ["pipdeptree", "cron-descriptor"]
weaviate = ["weaviate-client"] weaviate = ["weaviate-client"]
qdrant = ["qdrant-client"] qdrant = ["qdrant-client"]