services:
  redis:
    image: redis:latest
    container_name: redis
    restart: always
    ports:
      - "6379:6379"
    networks:
      - nice-net
    volumes:
      - type: volume
        source: cache_data
        target: /data
    command: redis-server --appendonly yes --requirepass ${REDIS_PASSWORD:-nice_redis_password}
    healthcheck:
      test: ["CMD", "redis-cli", "--raw", "incr", "ping"]
      interval: 10s
      timeout: 3s
      retries: 3

volumes:
  cache_data:
    driver: local
    driver_opts:
      type: none
      device: /opt/projects/nice/volumes/redis
      o: bind
