Skip to content

Add "windowsservercore" variant #106

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 4 commits 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
74 changes: 74 additions & 0 deletions 1.6/windows/windowsservercore/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
15 changes: 11 additions & 4 deletions generate-stackbrew-library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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-/}" )
Expand All @@ -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
10 changes: 10 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ for version in "${versions[@]}"; do
continue
fi

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)"

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)"

[[ "$versionTag" == *.*[^0-9]* ]] || versionTag+='.0'
Expand All @@ -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

Expand Down