services:
  postgres:
    image: postgres:16-alpine
    environment:
      POSTGRES_DB: rentaldrivego_test
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: password
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres -d rentaldrivego_test"]
      interval: 5s
      timeout: 5s
      retries: 10

  redis:
    image: redis:7-alpine

  test:
    build:
      context: .
      dockerfile: Dockerfile.test
    depends_on:
      postgres:
        condition: service_healthy
      redis:
        condition: service_started
    env_file:
      - .env.docker.test
