version: '3.8'

services:
  # Redis for caching, sessions, and queues
  redis:
    image: redis:7-alpine
    container_name: aot_redis
    ports:
      - "6379:6379"
    volumes:
      - redis_data:/data
      - ./redis.conf:/usr/local/etc/redis/redis.conf:ro
    command: redis-server /usr/local/etc/redis/redis.conf
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 3s
      retries: 3
    networks:
      - aot_network

  # Redis Commander - Web UI for Redis (optional, for development)
  redis-commander:
    image: rediscommander/redis-commander:latest
    container_name: aot_redis_commander
    environment:
      - REDIS_HOSTS=local:redis:6379
    ports:
      - "8081:8081"
    depends_on:
      - redis
    restart: unless-stopped
    networks:
      - aot_network
    profiles:
      - dev

volumes:
  redis_data:
    driver: local

networks:
  aot_network:
    driver: bridge
