services:
  api:
    build:
      context: .
      dockerfile: Dockerfile.dev
    command: ["bun", "--watch", "packages/api/src/index.ts"]
    network_mode: host
    volumes:
      - .:/app
      - ${HOME}/.claude:/home/${HOST_USER:-dispatch}/.claude
      - ${HOME}/.local/share/dispatch:/home/${HOST_USER:-dispatch}/.local/share/dispatch
      - ${HOME}/.skills:/home/${HOST_USER:-dispatch}/.skills
      - ${HOME}/.config/dispatch:/home/${HOST_USER:-dispatch}/.config/dispatch
    env_file:
      - .env.dispatch
    environment:
      HOST_UID: ${HOST_UID:-1000}
      HOST_GID: ${HOST_GID:-1000}
      HOST_USER: ${HOST_USER:-dispatch}
      DISPATCH_WORKING_DIR: /app

  frontend:
    build:
      context: .
      dockerfile: Dockerfile.dev
    command: ["bun", "run", "--cwd", "packages/frontend", "dev", "--", "--host"]
    network_mode: host
    volumes:
      - .:/app
    depends_on:
      api:
        condition: service_started
    environment:
      HOST_UID: ${HOST_UID:-1000}
      HOST_GID: ${HOST_GID:-1000}
      HOST_USER: ${HOST_USER:-dispatch}
      SKIP_INSTALL: "1"
