Set-Location C:\app\net48

# Run any scripts added by SRE/OPs.
$scriptsToRun = Get-ChildItem -Recurse -Filter *.ps1 "$PSScriptRoot\entrypointScripts-AutoRun" `
    | Where-Object { -not $_.DirectoryName.Contains("..") }

foreach ($script in $scriptsToRun) {
    Write-Host "Running $script"
    & $script.FullName
}

Write-Host "Copying extensions*.dll from C:\sharedvolume to C:\app\net48"
Copy-Item "C:\sharedvolume\extensions*.dll" "C:\app\net48" -Verbose

./DatabaseUpdater.exe
if (-Not $?) {
    Write-Host "Error applying database migrations"
    Exit 1
}
