version: '3.8'

services:
  postgres:
    image: postgres:15-alpine
    container_name: xpeditis-test-db
    environment:
      POSTGRES_DB: xpeditis_test
      POSTGRES_USER: xpeditis_test
      POSTGRES_PASSWORD: xpeditis_test_password
      PGDATA: /var/lib/postgresql/data/pgdata
    ports:
      - '5432:5432'
    volumes:
      - xpeditis_test_db:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U xpeditis_test"]
      interval: 5s
      timeout: 5s
      retries: 5

  redis:
    image: redis:7-alpine
    container_name: xpeditis-test-redis
    ports:
      - '6379:6379'
    volumes:
      - xpeditis_test_redis:/data
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 5s
      timeout: 3s
      retries: 5

volumes:
  xpeditis_test_db:
  xpeditis_test_redis:
