version: "3.8"

# Local test compose overlay — adds a Postgres service so you can run the
# full stack locally without an external DB. Use it together with
# docker-compose.prod.yml:
#
# docker compose -f rad/docker/docker-compose.prod.yml -f rad/docker/docker-compose.test.yml up -d --build

services:
  db:
    image: postgres:14-alpine
    restart: always
    environment:
      POSTGRES_USER: ${POSTGRES_USER:-django}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
      POSTGRES_DB: ${POSTGRES_DB:-rad}
    volumes:
      - postgres_test_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL","pg_isready -U ${POSTGRES_USER:-django}" ]
      interval: 10s
      timeout: 5s
      retries: 5

volumes:
  postgres_test_data:
