Initial Commit
This commit is contained in:
25
Build.ps1
Normal file
25
Build.ps1
Normal file
@@ -0,0 +1,25 @@
|
||||
$dockerfilesDirectory = "images"
|
||||
$baseFilePath = "base.txt"
|
||||
$baseImageLines = Get-Content -Path $baseFilePath
|
||||
|
||||
foreach ($file in Get-ChildItem -Path $dockerfilesDirectory -File) {
|
||||
$dockerfilePath = $file.FullName
|
||||
$dockerfileName = $file.Name
|
||||
|
||||
Write-Host "Processing Dockerfile: $dockerfilePath"
|
||||
|
||||
foreach ($baseImage in $baseImageLines) {
|
||||
$name = $dockerfileName.SubString(0, $dockerfileName.IndexOf("."))
|
||||
|
||||
$buildArgs = "--build-arg BASE_IMAGE=$baseImage"
|
||||
$dockerImageName = "git.119.224.65.18.sslip.io/siteorg/action-image-" + $name + ":$($baseImage.Replace('/', '_').Replace(':', '_'))"
|
||||
|
||||
Write-Host "Building image $dockerImageName"
|
||||
$buildCommand = "docker build -f $dockerfilePath $buildArgs -t $dockerImageName ."
|
||||
Invoke-Expression $buildCommand
|
||||
|
||||
Write-Host "Publishing image: $dockerImageName"
|
||||
$pushCommand = "docker push $dockerImageName"
|
||||
Invoke-Expression $pushCommand
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user