feat: add Migrator console project

- Dedicated HrynCo.NotificationService.Migrator console app
- Reads App:ConnectionString from config/env
- Calls db.Database.MigrateAsync() with clear log output
- Own Dockerfile (runtime:10.0 base, no SDK overhead)
- Replaces SDK volume-mount approach in docker-compose
- Added to solution with /docker/Migrator/ folder

Ref: IT-628

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Anatolii Grynchuk
2026-05-02 02:24:45 +03:00
parent 40b4071eb5
commit a8bc26fe38
6 changed files with 113 additions and 8 deletions
+3 -8
View File
@@ -1,18 +1,13 @@
services:
migrator:
image: mcr.microsoft.com/dotnet/sdk:10.0
working_dir: /src
volumes:
- ../..:/src
build:
context: ../..
dockerfile: HrynCo.NotificationService.Migrator/Dockerfile
environment:
- App__ConnectionString=${CONNECTION_STRING}
depends_on:
db:
condition: service_started
command:
- /bin/sh
- -c
- dotnet tool install --tool-path /tmp/dotnet-tools dotnet-ef --version "9.*" && until /tmp/dotnet-tools/dotnet-ef database update --project /src/HrynCo.NotificationService.DAL.EF --startup-project /src/HrynCo.NotificationService.Web; do echo "Migration failed, retrying in 3s..."; sleep 3; done
restart: "no"
api: