-
Notifications
You must be signed in to change notification settings - Fork 1
/
DockerBuild.Task.ps1
24 lines (23 loc) · 1.03 KB
/
DockerBuild.Task.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Add-BuildTask DockerBuild @{
# This task can only be skipped if the images are newer than the source files
If = $dotnetProjects
Inputs = {
$dotnetProjects.Where{ Get-ChildItem (Split-Path $_) -File -Filter Dockerfile } |
Get-ChildItem -File
}
Outputs = {
# We use the iidfile as a standing for date of the image
# Projects that have an adjacent Dockerfile
$dotnetProjects
| Where-Object { Get-ChildItem (Split-Path $_) -File -Filter Dockerfile }
| Join-Path -Path $OutputRoot -ChildPath { (Split-Path $_ -LeafBase).ToLower() }
}
Jobs = {
foreach ($project in $dotnetProjects.Where{ Get-ChildItem (Split-Path $_) -File -Filter Dockerfile }) {
Set-Location (Split-Path $project)
$name = (Split-Path $project -LeafBase).ToLower()
Write-Build Gray "docker build . --tag $name --iidfile $(Join-Path $OutputRoot $name)"
docker build . --tag $name --iidfile (Join-Path $OutputRoot $name)
}
}
}