Skip to content

Commit

Permalink
Containerise backend
Browse files Browse the repository at this point in the history
  • Loading branch information
Vishesh Arora committed Feb 4, 2024
1 parent 4eaa6f1 commit c8aa3f1
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
8 changes: 8 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM python:3.11

WORKDIR /app

COPY . /app

RUN pip install -r requirements.txt

6 changes: 6 additions & 0 deletions backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,9 @@
## Delete DB
`python3 delete_db.py`
## Deployment
```
docker compose up --build
```
19 changes: 19 additions & 0 deletions backend/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 1 addition & 2 deletions backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c8aa3f1

Please sign in to comment.