version: "3.8"

services:
  admin-backend:
    build:
      context: ../../
      dockerfile: admin/backend/Dockerfile
    container_name: web-sentinel-admin-backend
    environment:
      - WEB_SENTINEL_POSTGRES_URL=${WEB_SENTINEL_POSTGRES_URL}
      - WEB_SENTINEL_ADMIN_JWT_SECRET=${WEB_SENTINEL_ADMIN_JWT_SECRET:-change-me}
    ports:
      - "8000:8000"
    depends_on:
      - web-sentinel-db

  admin-frontend:
    build:
      context: ../../admin/frontend
      dockerfile: Dockerfile
    container_name: web-sentinel-admin-frontend
    environment:
      - VITE_API_URL=http://admin-backend:8000
    ports:
      - "5173:5173"
    depends_on:
      - admin-backend

  web-sentinel-db:
    image: postgres:15-alpine
    restart: unless-stopped
    environment:
      - POSTGRES_USER=websentinel_user
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
      - POSTGRES_DB=websentinel_prod
    volumes:
      - postgres_admin_data:/var/lib/postgresql/data
    ports:
      - "5433:5432"

volumes:
  postgres_admin_data:
