Skip to content

Commit 9cfc025

Browse files
committed
Run each image and test version
1 parent 49cccf0 commit 9cfc025

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

test-build.ps1

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
$ErrorActionPreference = 'Stop'
22

33
ForEach ($Dir in dir -directory | where { $_.Name -ne "docs" }) {
4-
Write-Host Building in $Dir
5-
$Version = ((cat $Dir\windows\windowsservercore\Dockerfile | Select-String -Pattern 'ENV NODE_VERSION') -split ' ')[2]
4+
$tag = ((cat $Dir\windows\windowsservercore\Dockerfile | Select-String -Pattern 'ENV NODE_VERSION') -split ' ')[2]
65

7-
docker build -t node:$version-windowsservercore $Dir\windows\windowsservercore
8-
docker build -t node:$version-windowsservercore-onbuild $Dir\windows\windowsservercore\onbuild
6+
$variants = @('windowsservercore', 'windowsservercore-onbuild', 'nanoserver', 'nanoserver-onbuild')
7+
ForEach ($variant in $variants) {
8+
$path = $variant -replace '-', '/'
9+
Write-Host Building node:$tag-$variant
10+
docker build -t node:$tag-$variant $Dir/windows/$path
911

10-
docker build -t node:$version-nanoserver $Dir\windows\nanoserver
11-
docker build -t node:$version-nanoserver-onbuild $Dir\windows\nanoserver\onbuild
12+
$OUTPUT=$(docker run --rm node:$tag-$variant node -e "process.stdout.write(process.versions.node)")
13+
if ( "$OUTPUT" -Ne "$tag" ) {
14+
Write-Error "Test of $tag-$variant failed!"
15+
} else {
16+
Write-Host "Test of $tag-$variant succeeded."
17+
}
18+
}
1219
}

0 commit comments

Comments
 (0)