diff --git a/1.6/windows/windowsservercore/Dockerfile b/1.6/windows/windowsservercore/Dockerfile new file mode 100644 index 00000000..8d33a339 --- /dev/null +++ b/1.6/windows/windowsservercore/Dockerfile @@ -0,0 +1,74 @@ +FROM microsoft/windowsservercore + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"] + +# install Git (especially for "go get") +ENV GIT_VERSION 2.9.2 +ENV GIT_TAG v${GIT_VERSION}.windows.1 +ENV GIT_DOWNLOAD_URL https://github.com/git-for-windows/git/releases/download/${GIT_TAG}/Git-${GIT_VERSION}-64-bit.exe +ENV GIT_DOWNLOAD_SHA256 006d971bcbe73cc8d841a100a4eb20d22e135142bf5b0f2120722fd420e166e5 +# steps inspired by "chcolateyInstall.ps1" from "git.install" (https://chocolatey.org/packages/git.install) +RUN Write-Host ('Downloading {0} ...' -f $env:GIT_DOWNLOAD_URL); \ + (New-Object System.Net.WebClient).DownloadFile($env:GIT_DOWNLOAD_URL, 'git.exe'); \ + \ + Write-Host ('Verifying sha256 ({0}) ...' -f $env:GIT_DOWNLOAD_SHA256); \ + if ((Get-FileHash git.exe -Algorithm sha256).Hash -ne $env:GIT_DOWNLOAD_SHA256) { \ + exit 1; \ + }; \ + \ + Write-Host 'Pre-configuring installer so it sets PATH ...'; \ + New-Item -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Git_is1' \ + | Out-Null; \ + New-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Git_is1' \ + -Name 'Inno Setup CodeFile: Path Option' \ + -Value 'CmdTools' \ + -PropertyType 'String' \ + -Force \ + | Out-Null; \ + \ + Write-Host 'Installing ...'; \ + Start-Process \ + -Wait \ + -FilePath ./git.exe \ +# http://www.jrsoftware.org/ishelp/topic_setupcmdline.htm + -ArgumentList @( \ + '/VERYSILENT', \ + '/NORESTART', \ + '/NOCANCEL', \ + '/SP-', \ + '/SUPPRESSMSGBOXES' \ + ); \ + \ + Write-Host 'Removing installer ...'; \ + Remove-Item git.exe -Force; \ + \ + Write-Host 'Complete.'; + +# 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 +ENV GOPATH C:\\gopath + +# PATH isn't actually set in the Docker image, so we have to set it from within the container +RUN [Environment]::SetEnvironmentVariable('PATH', $env:GOPATH + '\bin;C:\go\bin;' + $env:PATH, [EnvironmentVariableTarget]::Machine); +# doing this first to share cache across versions more aggressively + +ENV GOLANG_VERSION 1.6.3 +ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.windows-amd64.zip +ENV GOLANG_DOWNLOAD_SHA256 6a18e5ed8b39785338986aecc6a3f36f5c4be286ff52db0ae3bcd2275ab70df0 + +RUN Write-Host ('Downloading {0} ...' -f $env:GOLANG_DOWNLOAD_URL); \ + (New-Object System.Net.WebClient).DownloadFile($env:GOLANG_DOWNLOAD_URL, 'go.zip'); \ + \ + Write-Host ('Verifying sha256 ({0}) ...' -f $env:GOLANG_DOWNLOAD_SHA256); \ + if ((Get-FileHash go.zip -Algorithm sha256).Hash -ne $env:GOLANG_DOWNLOAD_SHA256) { \ + exit 1; \ + }; \ + \ + Write-Host 'Expanding ...'; \ + Expand-Archive go.zip -DestinationPath C:\; \ + \ + Write-Host 'Removing ...'; \ + Remove-Item go.zip -Force; \ + \ + Write-Host 'Complete.'; + +WORKDIR $GOPATH diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index 17a360f1..800de02e 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -68,10 +68,16 @@ for version in "${versions[@]}"; do Directory: $version EOE - for variant in onbuild cross wheezy alpine; do - [ -f "$version/$variant/Dockerfile" ] || continue + for v in \ + onbuild cross wheezy alpine \ + windows/windowsservercore windows/nanoserver \ + ; do + dir="$version/$v" + variant="$(basename "$v")" - commit="$(dirCommit "$version/$variant")" + [ -f "$dir/Dockerfile" ] || continue + + commit="$(dirCommit "$dir")" variantAliases=( "${versionAliases[@]/%/-$variant}" ) variantAliases=( "${variantAliases[@]//latest-/}" ) @@ -80,7 +86,8 @@ for version in "${versions[@]}"; do cat <<-EOE Tags: $(join ', ' "${variantAliases[@]}") GitCommit: $commit - Directory: $version/$variant + Directory: $dir EOE + [ "$variant" = "$v" ] || echo "Constraints: $variant" done done diff --git a/update.sh b/update.sh index b51846b3..fe61311a 100755 --- a/update.sh +++ b/update.sh @@ -33,6 +33,8 @@ for version in "${versions[@]}"; do continue fi + windowsSha256="$(echo $googleSource | grep -Po '">go'"$fullVersion"'\.windows-amd64\.zip.*?>[a-f0-9]{40,64}<' | sed -r 's!.*>([a-f0-9]{64})<.*!\1!; s!.*[<>]+.*!!' | tail -1)" + srcSha256="$(echo $googleSource | grep -Po '">go'"$fullVersion"'\.src\.tar\.gz.*?>[a-f0-9]{40,64}<' | sed -r 's!.*>([a-f0-9]{64})<.*!\1!; s!.*[<>]+.*!!' | tail -1)" [[ "$versionTag" == *.*[^0-9]* ]] || versionTag+='.0' @@ -58,6 +60,14 @@ for version in "${versions[@]}"; do travisEnv='\n - VERSION='"$version VARIANT=$variant$travisEnv" fi done + for variant in windows/windowsservercore windows/nanoserver; do + if [ -d "$version/$variant" ]; then + ( + set -x + sed -ri 's/^(ENV GOLANG_DOWNLOAD_SHA256) .*/\1 '"$windowsSha256"'/' "$version/$variant/Dockerfile" + ) + fi + done travisEnv='\n - VERSION='"$version VARIANT=$travisEnv" done