31 lines
950 B
PowerShell
31 lines
950 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 "=== Login to ACR ===" -ForegroundColor Cyan
|
|
az acr login --name $ACR
|
|
if ($LASTEXITCODE -ne 0) { throw "ACR login 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"
|