File size: 1,934 Bytes
05465db
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2c76876
05465db
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
version: '3.8'

services:
  # 1. PostgreSQL Database
  db:
    image: postgres:15-alpine
    container_name: prepai_db
    restart: always
    environment:
      POSTGRES_USER: ${POSTGRES_USER:-postgres}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-password}
      POSTGRES_DB: studentdb  # Database name used during initialization
    volumes:
      - postgres_data:/var/lib/postgresql/data
    ports:
      - "5432:5432"
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 5s
      timeout: 5s
      retries: 5

  # 2. ChromaDB Vector Store
  chromadb:
    image: chromadb/chroma
    container_name: prepai_chroma
    restart: always
    volumes:
      - chroma_data:/chroma/chroma
    ports:
      - "8080:8000" # Host 8080 maps to Container 8000 (standard chroma port)
    environment:
      - IS_PERSISTENT=TRUE

  # 3. Backend (FastAPI)
  backend:
    build: ./Backend
    container_name: prepai_backend
    restart: always
    depends_on:
      db:
        condition: service_healthy
      chromadb:
        condition: service_started
    ports:
      - "8000:8000"
    env_file:
      - .env
    environment:
      # Use 'studentdb' as the database name to match the 'db' service configuration
      DATABASE_URL: postgresql+asyncpg://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-password}@db:5432/studentdb
      chroma_host: chromadb
      chroma_port: 8000
      chroma_collection: prepai_collection
    volumes:
      # Mount code for hot-reloading during development
      - ./Backend:/app 
      - ./Backend/uploaded_pdfs:/app/uploaded_pdfs
      - ./Backend/transcripts:/app/transcripts

  # 4. Frontend (React + Vite served by Nginx)
  frontend:
    build: ./Frontend
    container_name: prepai_frontend
    restart: always
    ports:
      - "5173:80" # Map host port 5173 (browser access) to Nginx port 80
    depends_on:
      - backend

volumes:
  postgres_data:
  chroma_data: