version: '3.8'

services:
  # Test Database
  postgres-test:
    image: postgres:15-alpine
    environment:
      POSTGRES_DB: sttdb_test
      POSTGRES_USER: testuser
      POSTGRES_PASSWORD: testpass
    ports:
      - "5433:5432"
    volumes:
      - postgres_test_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U testuser -d sttdb_test"]
      interval: 5s
      timeout: 5s
      retries: 5

  # Test Redis
  redis-test:
    image: redis:7-alpine
    ports:
      - "6380:6379"
    command: redis-server --requirepass testpass
    healthcheck:
      test: ["CMD", "redis-cli", "-a", "testpass", "ping"]
      interval: 5s
      timeout: 3s
      retries: 5

  # Test Azure Storage Emulator (Azurite)
  azurite-test:
    image: mcr.microsoft.com/azure-storage/azurite
    ports:
      - "10000:10000"  # Blob service
      - "10001:10001"  # Queue service
      - "10002:10002"  # Table service
    command: azurite --blobHost 0.0.0.0 --queueHost 0.0.0.0 --tableHost 0.0.0.0
    volumes:
      - azurite_data:/data

volumes:
  postgres_test_data:
  azurite_data: