Skip to content

Fix some minor bugs in update.sh and add windowsservercore variants for 1.5 and 1.7 #108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions 1.5/windows/windowsservercore/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
33 changes: 22 additions & 11 deletions 1.6/windows/windowsservercore/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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; \
\
Expand All @@ -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; \
\
Expand Down
85 changes: 85 additions & 0 deletions 1.7/windows/windowsservercore/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
18 changes: 11 additions & 7 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down