version: '3.8'

services:
  postgres:
    image: postgres:15-alpine
    container_name: petify_postgres_local
    environment:
      POSTGRES_USER: ${DB_LOCAL_USERNAME}
      POSTGRES_PASSWORD: ${DB_LOCAL_PASSWORD}
      POSTGRES_DB: ${DB_LOCAL_NAME}
    ports:
      - "5433:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${DB_LOCAL_USERNAME} -d ${DB_LOCAL_NAME}"]
      interval: 10s
      timeout: 5s
      retries: 5

volumes:
  postgres_data:
