services:
  
  

  db:
    image: postgres:14
    container_name: postgres-db
    restart: always
    environment:
      POSTGRES_DB: gptbusiness
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: Nitin@2321
    ports:
      - "5432:5432"
    volumes:
      - postgres-data:/var/lib/postgresql/data
  
  backend_main:
    build:
      context: .
      dockerfile: chatapp_main/Dockerfile.backend
    volumes:
      - ./chatapp_main:/app/chatapp_main
    working_dir: /app/chatapp_main
    ports:
      - "8000:8000"
    depends_on:
      - db
    environment:
      - DB_HOST=db
      - DB_PORT=5432
      - DB_NAME=gptbusiness
      - DB_USER=postgres
      - DB_PASSWORD=Nitin@2321
    
  backend_chatapp:
    build:
      context: .
      dockerfile: chatapp/Dockerfile.backend
    volumes:
      - ./chatapp:/app/chatapp
    working_dir: /app/chatapp
    ports:
      - "8001:8001"
    depends_on:
      - db
    environment:
      - DB_HOST=db
      - DB_PORT=5432
      - DB_NAME=gptbusiness
      - DB_USER=postgres
      - DB_PASSWORD=Nitin@2321
  
  backend_emailapp:
    build:
      context: .
      dockerfile: emailapp2/Dockerfile.backend
    volumes:
      - ./emailapp2:/app/emailapp2
    working_dir: /app/emailapp2
    ports:
      - "8002:8000"
    depends_on:
      - db
    environment:
      - DB_HOST=db
      - DB_NAME=gptbusiness
      - DB_USER=postgres
      - DB_PASSWORD=Nitin@2321

  backend_chatapp_agent:
    build:
      context: .
      dockerfile: chatapp_agent/Dockerfile.backend
    volumes:
      - ./chatapp_agent:/app/chatapp_agent
    working_dir: /app/chatapp_agent
    ports:
      - "8003:8000"
    depends_on:
      - db
    environment:
      - DB_HOST=db
      - DB_NAME=gptbusiness
      - DB_USER=postgres
      - DB_PASSWORD=Nitin@2321
    
  redis:  
    image: redis:alpine
    ports:
      - "6379:6379" # Exposes Redis on port 6379
    volumes:
      - redis_data:/data


 
 
volumes:
  postgres-data:
  redis_data:
