version: '3.9'

services:
  postgres:
    image: postgres:16-alpine
    container_name: ranchlands_db
    restart: unless-stopped
    environment:
      POSTGRES_DB: ranchlands
      POSTGRES_USER: ranchlands
      POSTGRES_PASSWORD: ranchlands
    ports:
      - "5432:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ranchlands"]
      interval: 5s
      timeout: 5s
      retries: 5

  redis:
    image: redis:7-alpine
    container_name: ranchlands_redis
    restart: unless-stopped
    ports:
      - "6379:6379"
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 5s
      timeout: 3s
      retries: 5

volumes:
  postgres_data:
