[Local] Dockerized local test stack + always-show OTP in Development
CI/CD / CI · dotnet build (push) Successful in 32s
CI/CD / Deploy · hamkadr (push) Successful in 57s

Add docker-compose.local.yml + Dockerfile.local (public MS images + Liara NuGet) to run the whole app with a throwaway Postgres in one command for local testing, plus LOCAL.md. OtpService now never calls Kavenegar in the Development environment and always returns the code so the login page shows it on screen — guarantees local logins work with no SMS. Production behavior unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-06-04 19:21:47 +03:30
parent 2170ba250c
commit 6f02b1a0e9
4 changed files with 134 additions and 4 deletions
+50
View File
@@ -0,0 +1,50 @@
# 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:
- "8080: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:
- "5434:5432" # exposed for inspection; 5434 avoids clashing with your dev DB on 5433
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: