services:
  localstack:
    container_name: secretzero-localstack
    image: localstack/localstack:latest
    ports:
      - "4566"
      - "4510-4559"
    environment:
      - SERVICES=secretsmanager,kms,sts,ssm
      - DEBUG=1
      - DOCKER_HOST=unix:///var/run/docker.sock
      - AWS_DEFAULT_REGION=us-east-1
      - AWS_ACCESS_KEY_ID=test
      - AWS_SECRET_ACCESS_KEY=test
    volumes:
      - ./data/localstack/aws:/var/lib/localstack
      - /var/run/docker.sock:/var/run/docker.sock
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:4566/_localstack/health"]
      interval: 10s
      timeout: 5s
      retries: 5
      start_period: 10s

  # openbao:
  #   image: quay.io/openbao/openbao:latest
  #   container_name: openbao
  #   cap_add:
  #     - IPC_LOCK
  #   user: root
  #   ports:
  #     - "8200:8200"
  #   volumes:
  #     - ./data/bao/config:/bao/config:ro
  #     - ./data/bao/data:/bao/data
  #   environment:
  #     - BAO_ADDR=http://0.0.0.0:8200
  #     - BAO_API_ADDR=http://0.0.0.0:8200
  #     - SKIP_SETCAP=true
  #   command: server -config=/bao/config/openbao.hcl
  #   restart: unless-stopped
  vault:
    image: hashicorp/vault:latest
    container_name: vault
    cap_add:
      - IPC_LOCK
    user: root
    ports:
      - "8200:8200"
      - "8201:8201"
    privileged: true
    volumes:
      #- ./data/vault/config:/vault/config:ro
      - vault-data:/vault/data

    environment:
      - VAULT_ADDR=http://0.0.0.0:8200
      - VAULT_API_ADDR=http://0.0.0.0:8200
      - SKIP_SETCAP=true
    command: server -config=/vault/config/vault.hcl
    restart: unless-stopped

volumes:
  vault-data:

  # api:
  #   build:
  #     context: .
  #     target: api
  #   container_name: secretzero-api
  #   ports:
  #     - "8000:8000"
  #   volumes:
  #     - ./config.yaml:/app/config/config.yaml:ro
  #     - ./output:/app/output
  #     - ./repos:/app/repos
  #     - ~/.ssh:/root/.ssh:ro  # For private repo access via SSH keys
  #   environment:
  #     - TERRAFORM_INGEST_CONFIG=/app/config/config.yaml
  #     - UVICORN_HOST=0.0.0.0
  #     - UVICORN_PORT=8000
  #     - UVICORN_LOG_LEVEL=info
  #     - UVICORN_RELOAD=false
  #   profiles:
  #     - api
  #   restart: unless-stopped
  #   healthcheck:
  #     test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
  #     interval: 30s
  #     timeout: 10s
  #     retries: 3
  #     start_period: 5s
  #   # Override for API mode
  #   entrypoint: python
  #   command: ["-m", "uvicorn", "terraform_ingest.api:app", "--host", "0.0.0.0", "--port", "8000"]

  # localstack-azure:
  #   container_name: secretzero-localstack-azure
  #   image: localstack/localstack-azure-alpha:latest
  #   platform: linux/amd64
  #   ports:
  #     - "4566"
  #   environment:
  #     - SERVICES=keyvault,storage
  #     - DEBUG=1
  #     - DOCKER_HOST=unix:///var/run/docker.sock
  #     - AZURE_TENANT_ID=test-tenant-id
  #     - AZURE_SUBSCRIPTION_ID=test-subscription-id
  #     - ACTIVATE_PRO=0
  #     - LOCALSTACK_AUTH_TOKEN=mytoken
  #   volumes:
  #     - "${LOCALSTACK_VOLUME_DIR:-./localstack-data/azure}:/var/lib/localstack"
  #     - "/var/run/docker.sock:/var/run/docker.sock"
  #   networks:
  #     - secretzero-network
  #   healthcheck:
  #     test: ["CMD", "curl", "-f", "http://localhost:4566/_localstack/health"]
  #     interval: 10s
  #     timeout: 5s
  #     retries: 5
  #     start_period: 10s

# networks:
#   secretzero-network:
#     driver: bridge

# volumes:
#   localstack-data:
#   localstack-azure-data:
