# Docker Compose Configuration for goose
# AI-powered developer agent by Block
# https://github.com/block/goose

x-defaults: &defaults
  restart: unless-stopped
  logging:
    driver: json-file
    options:
      max-size: ${GOOSE_LOG_MAX_SIZE:-100m}
      max-file: '${GOOSE_LOG_MAX_FILE:-3}'

services:
  goose:
    <<: *defaults
    build:
      context: .
      dockerfile: Dockerfile
      platforms:
        - linux/amd64
        - linux/arm64
      args:
        - DEBIAN_VERSION=${DEBIAN_VERSION:-13.2-slim}
        - GOOSE_VERSION=${GOOSE_VERSION:-1.18.0}
    image: ${GLOBAL_REGISTRY:-}alexsuntop/goose:${GOOSE_VERSION:-1.18.0}
    environment:
      - TZ=${TZ:-UTC}
      # OpenAI Configuration
      - OPENAI_API_KEY=${OPENAI_API_KEY:-}
      - OPENAI_API_BASE=${OPENAI_API_BASE:-}
      # Anthropic Configuration
      - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY:-}
      # Google Configuration
      - GOOGLE_API_KEY=${GOOGLE_API_KEY:-}
      # Additional environment variables
      - GOOSE_PROVIDER=${GOOSE_PROVIDER:-openai}
      - GOOSE_MODEL=${GOOSE_MODEL:-gpt-4}
    volumes:
      - goose_config:/home/goose/.config/goose
      - goose_workspace:/workspace
    working_dir: /workspace
    stdin_open: true
    tty: true
    deploy:
      resources:
        limits:
          cpus: ${GOOSE_CPU_LIMIT:-2.00}
          memory: ${GOOSE_MEMORY_LIMIT:-2G}
        reservations:
          cpus: ${GOOSE_CPU_RESERVATION:-0.50}
          memory: ${GOOSE_MEMORY_RESERVATION:-512M}

volumes:
  goose_config:
  goose_workspace:
