# 設定 ASCII 藝術字的內容
$asciiArt = @"
  _____  ________      ________ _      ____  _____  __  __ ______ _   _ _______ 
 |  __ \|  ____\ \    / /  ____| |    / __ \|  __ \|  \/  |  ____| \ | |__   __|
 | |  | | |__   \ \  / /| |__  | |   | |  | | |__) | \  / | |__  |  \| |  | |   
 | |  | |  __|   \ \/ / |  __| | |   | |  | |  ___/| |\/| |  __| | . ` |  | |   
 | |__| | |____   \  /  | |____| |___| |__| | |    | |  | | |____| |\  |  | |   
 |_____/|______|   \/   |______|______\____/|_|    |_|  |_|______|_| \_|  |_|   
                                                                                
                                                                                
"@

# 顯示 ASCII 藝術字
Write-Host $asciiArt

#第一次建立專案請先設定ACR Name
$registryname="evdevcontainerregistry"
$fullregistryname="evdevcontainerregistry.azurecr.io"
#第一次建立專案請先設定專案名稱
$imagerepositoryname="server"
$dev_prefix = "Docker_test_"

$username = az account show --query user.name
$username = $username.TrimStart("""").Split('@')[0]

$tagname= $dev_prefix + $username

$fulltag=$fullregistryname+"/"+$imagerepositoryname+":"+$tagname
$imagename = $imagerepositoryname+":"+$tagname

$ssha = git rev-parse --short head

#wite ssha to file
$ssha | Out-File ssha

podman build ./ -t  $fulltag --label [gitcommit=$ssha,author=$username]

#remove ssha file
Remove-Item ssha