diff --git a/backend/Dockerfile b/backend/Dockerfile new file mode 100644 index 0000000..d30ed20 --- /dev/null +++ b/backend/Dockerfile @@ -0,0 +1,8 @@ +FROM python:3.11 + +WORKDIR /app + +COPY . /app + +RUN pip install -r requirements.txt + diff --git a/backend/README.md b/backend/README.md index 51bef2b..60e6ec3 100644 --- a/backend/README.md +++ b/backend/README.md @@ -29,3 +29,9 @@ ## Delete DB `python3 delete_db.py` + +## Deployment + +``` +docker compose up --build +``` \ No newline at end of file diff --git a/backend/docker-compose.yml b/backend/docker-compose.yml new file mode 100644 index 0000000..977da9d --- /dev/null +++ b/backend/docker-compose.yml @@ -0,0 +1,19 @@ +version: '3' + +services: + chroma: + image: chromadb/chroma + ports: + - 8000:8000 + volumes: + - /tmp/rando_data:/chroma/chroma + + web: + build: . + command: sh -c "sleep 10 && uvicorn main:app --reload --port=8080 --host=0.0.0.0" + env_file: + - .env + ports: + - 8080:8080 + depends_on: + - chroma \ No newline at end of file diff --git a/backend/main.py b/backend/main.py index 752e9f9..60816be 100644 --- a/backend/main.py +++ b/backend/main.py @@ -8,8 +8,7 @@ # Initialize FastAPI app app = FastAPI() -# In-memory database -client = chromadb.PersistentClient(path="/tmp") +client = chromadb.HttpClient(host="chroma", port = 8000) collection = client.get_or_create_collection(name="messages") # Initialize the custom logger