# Local development Postgres only.
# Run from backend/:  docker compose -f docker-compose.postgres.yml up -d
#
# Nest runs on your Mac/PC; use DATABASE_URL with host "localhost" (not "postgres").
# Variables POSTGRES_* and POSTGRES_PORT are read from .env (see .env.example).

services:
  postgres:
    image: postgres:15-alpine
    container_name: dyolink-postgres-dev
    restart: unless-stopped
    ports:
      - "${POSTGRES_PORT:-5432}:5432"
    environment:
      POSTGRES_USER: ${POSTGRES_USER:-dyolink_user}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-password}
      POSTGRES_DB: ${POSTGRES_DB:-dyolink_db}
    volumes:
      - dyolink_pgdata_dev:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
      interval: 5s
      timeout: 5s
      retries: 10
      start_period: 10s

volumes:
  dyolink_pgdata_dev:
    name: dyolink_postgres_data_dev
