# Local test stack — build from source + a throwaway Postgres. Nothing here touches production.
#
#   docker compose -f docker-compose.local.yml up --build
#   → open http://localhost:8080
#
# Runs in the Development environment, so:
#   • the login OTP code is shown ON SCREEN (no SMS sent via Kavenegar)
#   • sample Tehran demo data (facilities/shifts/jobs) is seeded automatically
# Admin login: phone 09120000000  → request code → the code appears on the page.
name: hamkadr-local

services:
  app:
    build:
      context: .
      dockerfile: Dockerfile.local
    container_name: hamkadr_local_app
    restart: unless-stopped
    depends_on:
      db:
        condition: service_healthy
    ports:
      - "18080:8080"
    environment:
      ASPNETCORE_ENVIRONMENT: "Development"     # ← OTP on screen, demo data, no Kavenegar
      ASPNETCORE_URLS: "http://+:8080"
      ConnectionStrings__Default: "Host=db;Port=5432;Database=hamkadr;Username=hamkadr;Password=hamkadr_local"
      Auth__AdminPhone: "09120000000"
      DOTNET_CLI_TELEMETRY_OPTOUT: "1"

  db:
    image: postgres:16-alpine
    container_name: hamkadr_local_db
    restart: unless-stopped
    environment:
      POSTGRES_DB: hamkadr
      POSTGRES_USER: hamkadr
      POSTGRES_PASSWORD: hamkadr_local
    ports:
      - "5544:5432"        # exposed for inspection on host port 5544 (5432/5433/5434 already in use)
    volumes:
      - hamkadr_local_db:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U hamkadr -d hamkadr"]
      interval: 5s
      timeout: 5s
      retries: 20

volumes:
  hamkadr_local_db:
