Skip to content

Commit a30dac9

Browse files
committed
Sync more closely with the non-Windows Dockerfile, update "update.sh" and "generate-stackbrew-library.sh"
1 parent 73a98b5 commit a30dac9

File tree

4 files changed

+53
-19
lines changed

4 files changed

+53
-19
lines changed

1.6/Dockerfile.windows

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM microsoft/windowsservercore
2+
3+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]
4+
5+
# ideally, this would be C:\go to match Linux a bit closer, but C:\go is the recommended install path for Go itself on Windows
6+
ENV GOPATH C:\\gopath
7+
8+
# PATH isn't actually set in the Docker image, so we have to set it from within the container
9+
RUN [Environment]::SetEnvironmentVariable('PATH', $env:GOPATH + '\bin;C:\go\bin;' + $env:PATH, [EnvironmentVariableTarget]::Machine);
10+
# doing this first to share cache across versions more aggressively
11+
12+
ENV GOLANG_VERSION 1.6.3
13+
ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.windows-amd64.zip
14+
ENV GOLANG_DOWNLOAD_SHA256 6a18e5ed8b39785338986aecc6a3f36f5c4be286ff52db0ae3bcd2275ab70df0
15+
16+
RUN Write-Host ('Downloading {0} ...' -f $env:GOLANG_DOWNLOAD_URL); \
17+
(New-Object System.Net.WebClient).DownloadFile($env:GOLANG_DOWNLOAD_URL, 'go.zip'); \
18+
\
19+
Write-Host ('Verifying sha256 ({0}) ...' -f $env:GOLANG_DOWNLOAD_SHA256); \
20+
if ((Get-FileHash go.zip -Algorithm sha256).Hash -ne $env:GOLANG_DOWNLOAD_SHA256) { \
21+
exit 1; \
22+
}; \
23+
\
24+
Write-Host 'Expanding ...'; \
25+
Expand-Archive go.zip -DestinationPath C:\; \
26+
\
27+
Write-Host 'Removing ...'; \
28+
Remove-Item go.zip -Force; \
29+
\
30+
Write-Host 'Complete.';
31+
32+
WORKDIR $GOPATH

generate-stackbrew-library.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,16 @@ for version in "${versions[@]}"; do
6868
Directory: $version
6969
EOE
7070

71-
for variant in onbuild cross wheezy alpine; do
72-
[ -f "$version/$variant/Dockerfile" ] || continue
71+
for v in \
72+
onbuild cross wheezy alpine \
73+
windows/windowsservercore windows/nanoserver \
74+
; do
75+
dir="$version/$v"
76+
variant="$(basename "$v")"
7377

74-
commit="$(dirCommit "$version/$variant")"
78+
[ -f "$dir/Dockerfile" ] || continue
79+
80+
commit="$(dirCommit "$dir")"
7581

7682
variantAliases=( "${versionAliases[@]/%/-$variant}" )
7783
variantAliases=( "${variantAliases[@]//latest-/}" )
@@ -80,7 +86,8 @@ for version in "${versions[@]}"; do
8086
cat <<-EOE
8187
Tags: $(join ', ' "${variantAliases[@]}")
8288
GitCommit: $commit
83-
Directory: $version/$variant
89+
Directory: $dir
8490
EOE
91+
[ "$variant" = "$v" ] || echo "Constraints: $variant"
8592
done
8693
done

update.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ for version in "${versions[@]}"; do
3333
continue
3434
fi
3535

36+
windowsSha256="$(echo $googleSource | grep -Po '">go'"$fullVersion"'\.windows-amd64\.zip</a>.*?>[a-f0-9]{40,64}<' | sed -r 's!.*>([a-f0-9]{64})<.*!\1!; s!.*[<>]+.*!!' | tail -1)"
37+
3638
srcSha256="$(echo $googleSource | grep -Po '">go'"$fullVersion"'\.src\.tar\.gz</a>.*?>[a-f0-9]{40,64}<' | sed -r 's!.*>([a-f0-9]{64})<.*!\1!; s!.*[<>]+.*!!' | tail -1)"
3739

3840
[[ "$versionTag" == *.*[^0-9]* ]] || versionTag+='.0'
@@ -58,6 +60,14 @@ for version in "${versions[@]}"; do
5860
travisEnv='\n - VERSION='"$version VARIANT=$variant$travisEnv"
5961
fi
6062
done
63+
for variant in windows; do
64+
if [ -d "$version/$variant" ]; then
65+
(
66+
set -x
67+
sed -ri 's/^(ENV GOLANG_DOWNLOAD_SHA256) .*/\1 '"$windowsSha256"'/' "$version/$variant/Dockerfile"
68+
)
69+
fi
70+
done
6171
travisEnv='\n - VERSION='"$version VARIANT=$travisEnv"
6272
done
6373

0 commit comments

Comments
 (0)