version: '3.8'

services:
  db:
    image: postgres:17
    ports:
      - "5431:5432"
    environment:
      POSTGRES_USER: cvsa
      POSTGRES_PASSWORD: ""
      POSTGRES_DB: cvsa_main
    volumes:
      - ./data:/var/lib/postgresql/data
  
  redis:
    image: redis:latest
    ports:
      - "6378:6379"
    volumes:
      - ./redis/data:/data
      - ./redis/redis.conf:/usr/local/etc/redis/redis.conf
      - ./redis/logs:/logs

  frontend:
    build:
      context: .
      dockerfile: Dockerfile.frontend
    ports:
      - "4321:4321"
    environment:
      - HOST=0.0.0.0
      - PORT=4321
      - DB_HOST=db
      - DB_NAME=cvsa_main
      - DB_NAME_CRED=cvsa_cred
      - DB_USER=cvsa
      - DB_PORT=5432
      - DB_PASSWORD=""
      - LOG_VERBOSE=/app/logs/verbose.log
      - LOG_WARN=/app/logs/warn.log
      - LOG_ERR=/app/logs/error.log
    depends_on:
      - db
    volumes:
      - /path/to/your/logs:/app/logs
  backend:
    build:
      context: .
      dockerfile: Dockerfile.backend
    ports:
      - "8000:8000"
    environment:
      - HOST=0.0.0.0
      - DB_HOST=db
      - DB_NAME=cvsa_main
      - DB_NAME_CRED=cvsa_cred
      - DB_USER=cvsa
      - DB_PORT=5432
      - DB_PASSWORD=""
      - LOG_VERBOSE=/app/logs/verbose.log
      - LOG_WARN=/app/logs/warn.log
      - LOG_ERR=/app/logs/error.log
      - REDIS_HOST=redis
      - REDIS_PORT=6379
    depends_on:
      - db
    volumes:
      - /path/to/your/logs:/app/logs

volumes:
  db_data: