diff --git a/1.5/windows/windowsservercore/Dockerfile b/1.5/windows/windowsservercore/Dockerfile new file mode 100644 index 00000000..70ab39b1 --- /dev/null +++ b/1.5/windows/windowsservercore/Dockerfile @@ -0,0 +1,85 @@ +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) { \ + Write-Host 'FAILED!'; \ + exit 1; \ + }; \ + \ + Write-Host 'Installing ...'; \ + Start-Process \ + -Wait \ + -FilePath ./git.exe \ +# http://www.jrsoftware.org/ishelp/topic_setupcmdline.htm + -ArgumentList @( \ + '/VERYSILENT', \ + '/NORESTART', \ + '/NOCANCEL', \ + '/SP-', \ + '/SUPPRESSMSGBOXES', \ + \ +# https://github.com/git-for-windows/build-extra/blob/353f965e0e2af3e8c993930796975f9ce512c028/installer/install.iss#L87-L96 + '/COMPONENTS=assoc_sh', \ + \ +# set "/DIR" so we can set "PATH" afterwards +# see https://disqus.com/home/discussion/chocolatey/chocolatey_gallery_git_install_1710/#comment-2834659433 for why we don't use "/LOADINF=..." to let the installer set PATH + '/DIR=C:\git' \ + ); \ + \ + Write-Host 'Updating PATH ...'; \ + $env:PATH = 'C:\git\bin;C:\git\mingw64\bin;C:\git\usr\bin;' + $env:PATH; \ + [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \ + \ + Write-Host 'Verifying install ...'; \ + Write-Host ' git --version'; git --version; \ + Write-Host ' bash --version'; bash --version; \ + Write-Host ' curl --version'; curl.exe --version; \ + \ + 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.5.4 +ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.windows-amd64.zip +ENV GOLANG_DOWNLOAD_SHA256 1201053d5659a5fc5c82dff58c3eaee66ecd02901621725cfdfff1681278bd1a + +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) { \ + Write-Host 'FAILED!'; \ + exit 1; \ + }; \ + \ + Write-Host 'Expanding ...'; \ + Expand-Archive go.zip -DestinationPath C:\; \ + \ + Write-Host 'Verifying install ("go version") ...'; \ + go version; \ + \ + Write-Host 'Removing ...'; \ + Remove-Item go.zip -Force; \ + \ + Write-Host 'Complete.'; + +WORKDIR $GOPATH diff --git a/1.6/windows/windowsservercore/Dockerfile b/1.6/windows/windowsservercore/Dockerfile index 8d33a339..241322cc 100644 --- a/1.6/windows/windowsservercore/Dockerfile +++ b/1.6/windows/windowsservercore/Dockerfile @@ -13,19 +13,10 @@ RUN Write-Host ('Downloading {0} ...' -f $env:GIT_DOWNLOAD_URL); \ \ Write-Host ('Verifying sha256 ({0}) ...' -f $env:GIT_DOWNLOAD_SHA256); \ if ((Get-FileHash git.exe -Algorithm sha256).Hash -ne $env:GIT_DOWNLOAD_SHA256) { \ + Write-Host 'FAILED!'; \ 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 \ @@ -36,9 +27,25 @@ RUN Write-Host ('Downloading {0} ...' -f $env:GIT_DOWNLOAD_URL); \ '/NORESTART', \ '/NOCANCEL', \ '/SP-', \ - '/SUPPRESSMSGBOXES' \ + '/SUPPRESSMSGBOXES', \ + \ +# https://github.com/git-for-windows/build-extra/blob/353f965e0e2af3e8c993930796975f9ce512c028/installer/install.iss#L87-L96 + '/COMPONENTS=assoc_sh', \ + \ +# set "/DIR" so we can set "PATH" afterwards +# see https://disqus.com/home/discussion/chocolatey/chocolatey_gallery_git_install_1710/#comment-2834659433 for why we don't use "/LOADINF=..." to let the installer set PATH + '/DIR=C:\git' \ ); \ \ + Write-Host 'Updating PATH ...'; \ + $env:PATH = 'C:\git\bin;C:\git\mingw64\bin;C:\git\usr\bin;' + $env:PATH; \ + [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \ + \ + Write-Host 'Verifying install ...'; \ + Write-Host ' git --version'; git --version; \ + Write-Host ' bash --version'; bash --version; \ + Write-Host ' curl --version'; curl.exe --version; \ + \ Write-Host 'Removing installer ...'; \ Remove-Item git.exe -Force; \ \ @@ -60,12 +67,16 @@ RUN Write-Host ('Downloading {0} ...' -f $env:GOLANG_DOWNLOAD_URL); \ \ Write-Host ('Verifying sha256 ({0}) ...' -f $env:GOLANG_DOWNLOAD_SHA256); \ if ((Get-FileHash go.zip -Algorithm sha256).Hash -ne $env:GOLANG_DOWNLOAD_SHA256) { \ + Write-Host 'FAILED!'; \ exit 1; \ }; \ \ Write-Host 'Expanding ...'; \ Expand-Archive go.zip -DestinationPath C:\; \ \ + Write-Host 'Verifying install ("go version") ...'; \ + go version; \ + \ Write-Host 'Removing ...'; \ Remove-Item go.zip -Force; \ \ diff --git a/1.7/windows/windowsservercore/Dockerfile b/1.7/windows/windowsservercore/Dockerfile new file mode 100644 index 00000000..b135ed98 --- /dev/null +++ b/1.7/windows/windowsservercore/Dockerfile @@ -0,0 +1,85 @@ +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) { \ + Write-Host 'FAILED!'; \ + exit 1; \ + }; \ + \ + Write-Host 'Installing ...'; \ + Start-Process \ + -Wait \ + -FilePath ./git.exe \ +# http://www.jrsoftware.org/ishelp/topic_setupcmdline.htm + -ArgumentList @( \ + '/VERYSILENT', \ + '/NORESTART', \ + '/NOCANCEL', \ + '/SP-', \ + '/SUPPRESSMSGBOXES', \ + \ +# https://github.com/git-for-windows/build-extra/blob/353f965e0e2af3e8c993930796975f9ce512c028/installer/install.iss#L87-L96 + '/COMPONENTS=assoc_sh', \ + \ +# set "/DIR" so we can set "PATH" afterwards +# see https://disqus.com/home/discussion/chocolatey/chocolatey_gallery_git_install_1710/#comment-2834659433 for why we don't use "/LOADINF=..." to let the installer set PATH + '/DIR=C:\git' \ + ); \ + \ + Write-Host 'Updating PATH ...'; \ + $env:PATH = 'C:\git\bin;C:\git\mingw64\bin;C:\git\usr\bin;' + $env:PATH; \ + [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \ + \ + Write-Host 'Verifying install ...'; \ + Write-Host ' git --version'; git --version; \ + Write-Host ' bash --version'; bash --version; \ + Write-Host ' curl --version'; curl.exe --version; \ + \ + 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.7rc6 +ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.windows-amd64.zip +ENV GOLANG_DOWNLOAD_SHA256 f043f7327049340e078ded4f9eed0b811f8cfa1adb7492403d3dea9cfebee13b + +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) { \ + Write-Host 'FAILED!'; \ + exit 1; \ + }; \ + \ + Write-Host 'Expanding ...'; \ + Expand-Archive go.zip -DestinationPath C:\; \ + \ + Write-Host 'Verifying install ("go version") ...'; \ + go version; \ + \ + Write-Host 'Removing ...'; \ + Remove-Item go.zip -Force; \ + \ + Write-Host 'Complete.'; + +WORKDIR $GOPATH diff --git a/update.sh b/update.sh index fe61311a..58f3c533 100755 --- a/update.sh +++ b/update.sh @@ -40,12 +40,13 @@ for version in "${versions[@]}"; do [[ "$versionTag" == *.*[^0-9]* ]] || versionTag+='.0' ( set -x - sed -ri ' - s/^(ENV GOLANG_VERSION) .*/\1 '"$fullVersion"'/; - s/^(ENV GOLANG_DOWNLOAD_SHA256) .*/\1 '"$linuxSha256"'/; - s/^(ENV GOLANG_SRC_SHA256) .*/\1 '"$srcSha256"'/; - s/^(FROM golang):.*/\1:'"$version"'/; - ' "$version/Dockerfile" "$version/"*"/Dockerfile" + sed -ri \ + -e 's/^(ENV GOLANG_VERSION) .*/\1 '"$fullVersion"'/' \ + -e 's/^(ENV GOLANG_DOWNLOAD_SHA256) .*/\1 '"$linuxSha256"'/' \ + -e 's/^(ENV GOLANG_SRC_SHA256) .*/\1 '"$srcSha256"'/' \ + -e 's/^(FROM golang):.*/\1:'"$version"'/' \ + "$version/Dockerfile" \ + "$version/"*"/Dockerfile" cp go-wrapper "$version/" ) for variant in alpine wheezy; do @@ -64,7 +65,10 @@ for version in "${versions[@]}"; do if [ -d "$version/$variant" ]; then ( set -x - sed -ri 's/^(ENV GOLANG_DOWNLOAD_SHA256) .*/\1 '"$windowsSha256"'/' "$version/$variant/Dockerfile" + sed -ri \ + -e 's/^(ENV GOLANG_VERSION) .*/\1 '"$fullVersion"'/' \ + -e 's/^(ENV GOLANG_DOWNLOAD_SHA256) .*/\1 '"$windowsSha256"'/' \ + "$version/$variant/Dockerfile" ) fi done