services:
  cloud_backend:
    build: ./cloud_backend
    ports:
      - "8001:8001"
    restart: unless-stopped
    env_file:
      - ./cloud_backend/.env
    volumes:
      - ./data/cloud:/app/data

  backend:
    build: ./local_backend
    ports:
      - "8000:8000"
    restart: unless-stopped
    env_file:
      - ./local_backend/.env
    volumes:
      - ./local_backend/pos.db:/app/pos.db
      - ./local_backend/license_state.json:/app/license_state.json
      - ./logo.png:/app/logo.png:ro
      - ./data/product_images:/app/data/product_images
      - ./data/avatars:/app/data/avatars
    extra_hosts:
      - "host.docker.internal:host-gateway"

  waiter_pwa:
    image: node:20-alpine
    working_dir: /app
    volumes:
      - ./waiter_pwa:/app
    ports:
      - "5173:5173"
    command: sh -c "npm install --legacy-peer-deps && npm run dev -- --host 0.0.0.0"
    env_file:
      - ./waiter_pwa/.env
    depends_on:
      - backend
    restart: unless-stopped

  manager_dashboard:
    image: node:20-alpine
    working_dir: /app
    volumes:
      - ./manager_dashboard:/app
    ports:
      - "5174:5174"
    command: sh -c "npm install && npm run dev -- --host 0.0.0.0"
    env_file:
      - ./manager_dashboard/.env
    depends_on:
      - backend
    restart: unless-stopped

  sysadmin_panel:
    image: node:20-alpine
    working_dir: /app
    volumes:
      - ./sysadmin_panel:/app
    ports:
      - "5175:5175"
    command: sh -c "npm install && npm run dev -- --host 0.0.0.0"
    env_file:
      - ./sysadmin_panel/.env
    depends_on:
      - cloud_backend
    restart: unless-stopped
