Ka-Note/ka-note/deploy.ps1

27 lines
814 B
PowerShell

$ErrorActionPreference = "Stop"
$ACR = "koogleacr"
$APP = "ka-note"
$RG = "rg-koogle-prod"
$IMAGE = "$ACR.azurecr.io/${APP}:latest"
Write-Host "=== Generate migrations ===" -ForegroundColor Cyan
Push-Location server
npx drizzle-kit generate
Pop-Location
if ($LASTEXITCODE -ne 0) { throw "Migration generation failed" }
Write-Host "=== Build Docker image ===" -ForegroundColor Cyan
docker build -t $IMAGE .
if ($LASTEXITCODE -ne 0) { throw "Docker build failed" }
Write-Host "=== Push to ACR ===" -ForegroundColor Cyan
docker push $IMAGE
if ($LASTEXITCODE -ne 0) { throw "Docker push failed" }
Write-Host "=== Restart App Service ===" -ForegroundColor Cyan
az webapp restart --name $APP --resource-group $RG
Write-Host "=== Done! ===" -ForegroundColor Green
Write-Host "Check: https://$APP.azurewebsites.net"