version: '3.9'

services:
  # Goosed 实例 1
  goosed-1:
    build:
      context: ./tkmind_go
      dockerfile: Dockerfile.goosed
    container_name: goosed-1
    ports:
      - "18006:18006"
    environment:
      GOOSE_HOST: 0.0.0.0
      GOOSE_PORT: 18006
      GOOSE_SERVER__SECRET_KEY: ${GOOSE_SERVER__SECRET_KEY:-local-dev-secret-key}
      # 可选：Debug 日志
      RUST_LOG: ${RUST_LOG:-info}
    volumes:
      - goosed-1-data:/home/goose/.local/share/goose
    healthcheck:
      test: ["CMD", "curl", "-f", "http://127.0.0.1:18006/status"]
      interval: 10s
      timeout: 5s
      retries: 3
      start_period: 20s
    restart: unless-stopped
    networks:
      - local-dev

  # Goosed 实例 2（可选）
  goosed-2:
    build:
      context: ./tkmind_go
      dockerfile: Dockerfile.goosed
    container_name: goosed-2
    ports:
      - "18007:18006"
    environment:
      GOOSE_HOST: 0.0.0.0
      GOOSE_PORT: 18006
      GOOSE_SERVER__SECRET_KEY: ${GOOSE_SERVER__SECRET_KEY:-local-dev-secret-key}
      RUST_LOG: ${RUST_LOG:-info}
    volumes:
      - goosed-2-data:/home/goose/.local/share/goose
    healthcheck:
      test: ["CMD", "curl", "-f", "http://127.0.0.1:18006/status"]
      interval: 10s
      timeout: 5s
      retries: 3
      start_period: 20s
    restart: unless-stopped
    networks:
      - local-dev
    depends_on:
      - goosed-1

volumes:
  goosed-1-data:
  goosed-2-data:

networks:
  local-dev:
    driver: bridge
