Skip to content

Commit cef27b1

Browse files
authored
Merge pull request #147 from friism/upgrade-win-git-and-use-mingit
Update Git for Windows to 2.11.1 and use MinGit
2 parents af51d4e + 3bccc59 commit cef27b1

File tree

3 files changed

+45
-93
lines changed

3 files changed

+45
-93
lines changed

1.6/windows/windowsservercore/Dockerfile

Lines changed: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,52 +3,36 @@ FROM microsoft/windowsservercore
33
# $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324
44
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
55

6-
# install Git (especially for "go get")
7-
ENV GIT_VERSION 2.11.0
6+
# install MinGit (especially for "go get")
7+
# https://blogs.msdn.microsoft.com/visualstudioalm/2016/09/03/whats-new-in-git-for-windows-2-10/
8+
# "Essentially, it is a Git for Windows that was stripped down as much as possible without sacrificing the functionality in which 3rd-party software may be interested."
9+
# "It currently requires only ~45MB on disk."
10+
ENV GIT_VERSION 2.11.1
811
ENV GIT_TAG v${GIT_VERSION}.windows.1
9-
ENV GIT_DOWNLOAD_URL https://github.com/git-for-windows/git/releases/download/${GIT_TAG}/Git-${GIT_VERSION}-64-bit.exe
10-
ENV GIT_DOWNLOAD_SHA256 fd1937ea8468461d35d9cabfcdd2daa3a74509dc9213c43c2b9615e8f0b85086
12+
ENV GIT_DOWNLOAD_URL https://github.com/git-for-windows/git/releases/download/${GIT_TAG}/MinGit-${GIT_VERSION}-64-bit.zip
13+
ENV GIT_DOWNLOAD_SHA256 668d16a799dd721ed126cc91bed49eb2c072ba1b25b50048280a4e2c5ed56e59
1114
# steps inspired by "chcolateyInstall.ps1" from "git.install" (https://chocolatey.org/packages/git.install)
1215
RUN Write-Host ('Downloading {0} ...' -f $env:GIT_DOWNLOAD_URL); \
13-
Invoke-WebRequest -Uri $env:GIT_DOWNLOAD_URL -OutFile 'git.exe'; \
16+
Invoke-WebRequest -Uri $env:GIT_DOWNLOAD_URL -OutFile 'git.zip'; \
1417
\
1518
Write-Host ('Verifying sha256 ({0}) ...' -f $env:GIT_DOWNLOAD_SHA256); \
16-
if ((Get-FileHash git.exe -Algorithm sha256).Hash -ne $env:GIT_DOWNLOAD_SHA256) { \
19+
if ((Get-FileHash git.zip -Algorithm sha256).Hash -ne $env:GIT_DOWNLOAD_SHA256) { \
1720
Write-Host 'FAILED!'; \
1821
exit 1; \
1922
}; \
2023
\
21-
Write-Host 'Installing ...'; \
22-
Start-Process \
23-
-Wait \
24-
-FilePath ./git.exe \
25-
# http://www.jrsoftware.org/ishelp/topic_setupcmdline.htm
26-
-ArgumentList @( \
27-
'/VERYSILENT', \
28-
'/NORESTART', \
29-
'/NOCANCEL', \
30-
'/SP-', \
31-
'/SUPPRESSMSGBOXES', \
32-
\
33-
# https://github.com/git-for-windows/build-extra/blob/353f965e0e2af3e8c993930796975f9ce512c028/installer/install.iss#L87-L96
34-
'/COMPONENTS=assoc_sh', \
35-
\
36-
# set "/DIR" so we can set "PATH" afterwards
37-
# 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
38-
'/DIR=C:\git' \
39-
); \
24+
Write-Host 'Expanding ...'; \
25+
Expand-Archive -Path git.zip -DestinationPath C:\git\.; \
26+
\
27+
Write-Host 'Removing ...'; \
28+
Remove-Item git.zip -Force; \
4029
\
4130
Write-Host 'Updating PATH ...'; \
42-
$env:PATH = 'C:\git\bin;C:\git\mingw64\bin;C:\git\usr\bin;' + $env:PATH; \
31+
$env:PATH = 'C:\git\cmd;C:\git\mingw64\bin;C:\git\usr\bin;' + $env:PATH; \
4332
[Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \
4433
\
4534
Write-Host 'Verifying install ...'; \
4635
Write-Host ' git --version'; git --version; \
47-
Write-Host ' bash --version'; bash --version; \
48-
Write-Host ' curl --version'; curl.exe --version; \
49-
\
50-
Write-Host 'Removing installer ...'; \
51-
Remove-Item git.exe -Force; \
5236
\
5337
Write-Host 'Complete.';
5438

1.7/windows/windowsservercore/Dockerfile

Lines changed: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,52 +3,36 @@ FROM microsoft/windowsservercore
33
# $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324
44
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
55

6-
# install Git (especially for "go get")
7-
ENV GIT_VERSION 2.11.0
6+
# install MinGit (especially for "go get")
7+
# https://blogs.msdn.microsoft.com/visualstudioalm/2016/09/03/whats-new-in-git-for-windows-2-10/
8+
# "Essentially, it is a Git for Windows that was stripped down as much as possible without sacrificing the functionality in which 3rd-party software may be interested."
9+
# "It currently requires only ~45MB on disk."
10+
ENV GIT_VERSION 2.11.1
811
ENV GIT_TAG v${GIT_VERSION}.windows.1
9-
ENV GIT_DOWNLOAD_URL https://github.com/git-for-windows/git/releases/download/${GIT_TAG}/Git-${GIT_VERSION}-64-bit.exe
10-
ENV GIT_DOWNLOAD_SHA256 fd1937ea8468461d35d9cabfcdd2daa3a74509dc9213c43c2b9615e8f0b85086
12+
ENV GIT_DOWNLOAD_URL https://github.com/git-for-windows/git/releases/download/${GIT_TAG}/MinGit-${GIT_VERSION}-64-bit.zip
13+
ENV GIT_DOWNLOAD_SHA256 668d16a799dd721ed126cc91bed49eb2c072ba1b25b50048280a4e2c5ed56e59
1114
# steps inspired by "chcolateyInstall.ps1" from "git.install" (https://chocolatey.org/packages/git.install)
1215
RUN Write-Host ('Downloading {0} ...' -f $env:GIT_DOWNLOAD_URL); \
13-
Invoke-WebRequest -Uri $env:GIT_DOWNLOAD_URL -OutFile 'git.exe'; \
16+
Invoke-WebRequest -Uri $env:GIT_DOWNLOAD_URL -OutFile 'git.zip'; \
1417
\
1518
Write-Host ('Verifying sha256 ({0}) ...' -f $env:GIT_DOWNLOAD_SHA256); \
16-
if ((Get-FileHash git.exe -Algorithm sha256).Hash -ne $env:GIT_DOWNLOAD_SHA256) { \
19+
if ((Get-FileHash git.zip -Algorithm sha256).Hash -ne $env:GIT_DOWNLOAD_SHA256) { \
1720
Write-Host 'FAILED!'; \
1821
exit 1; \
1922
}; \
2023
\
21-
Write-Host 'Installing ...'; \
22-
Start-Process \
23-
-Wait \
24-
-FilePath ./git.exe \
25-
# http://www.jrsoftware.org/ishelp/topic_setupcmdline.htm
26-
-ArgumentList @( \
27-
'/VERYSILENT', \
28-
'/NORESTART', \
29-
'/NOCANCEL', \
30-
'/SP-', \
31-
'/SUPPRESSMSGBOXES', \
32-
\
33-
# https://github.com/git-for-windows/build-extra/blob/353f965e0e2af3e8c993930796975f9ce512c028/installer/install.iss#L87-L96
34-
'/COMPONENTS=assoc_sh', \
35-
\
36-
# set "/DIR" so we can set "PATH" afterwards
37-
# 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
38-
'/DIR=C:\git' \
39-
); \
24+
Write-Host 'Expanding ...'; \
25+
Expand-Archive -Path git.zip -DestinationPath C:\git\.; \
26+
\
27+
Write-Host 'Removing ...'; \
28+
Remove-Item git.zip -Force; \
4029
\
4130
Write-Host 'Updating PATH ...'; \
42-
$env:PATH = 'C:\git\bin;C:\git\mingw64\bin;C:\git\usr\bin;' + $env:PATH; \
31+
$env:PATH = 'C:\git\cmd;C:\git\mingw64\bin;C:\git\usr\bin;' + $env:PATH; \
4332
[Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \
4433
\
4534
Write-Host 'Verifying install ...'; \
4635
Write-Host ' git --version'; git --version; \
47-
Write-Host ' bash --version'; bash --version; \
48-
Write-Host ' curl --version'; curl.exe --version; \
49-
\
50-
Write-Host 'Removing installer ...'; \
51-
Remove-Item git.exe -Force; \
5236
\
5337
Write-Host 'Complete.';
5438

1.8-rc/windows/windowsservercore/Dockerfile

Lines changed: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,52 +3,36 @@ FROM microsoft/windowsservercore
33
# $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324
44
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
55

6-
# install Git (especially for "go get")
7-
ENV GIT_VERSION 2.11.0
6+
# install MinGit (especially for "go get")
7+
# https://blogs.msdn.microsoft.com/visualstudioalm/2016/09/03/whats-new-in-git-for-windows-2-10/
8+
# "Essentially, it is a Git for Windows that was stripped down as much as possible without sacrificing the functionality in which 3rd-party software may be interested."
9+
# "It currently requires only ~45MB on disk."
10+
ENV GIT_VERSION 2.11.1
811
ENV GIT_TAG v${GIT_VERSION}.windows.1
9-
ENV GIT_DOWNLOAD_URL https://github.com/git-for-windows/git/releases/download/${GIT_TAG}/Git-${GIT_VERSION}-64-bit.exe
10-
ENV GIT_DOWNLOAD_SHA256 fd1937ea8468461d35d9cabfcdd2daa3a74509dc9213c43c2b9615e8f0b85086
12+
ENV GIT_DOWNLOAD_URL https://github.com/git-for-windows/git/releases/download/${GIT_TAG}/MinGit-${GIT_VERSION}-64-bit.zip
13+
ENV GIT_DOWNLOAD_SHA256 668d16a799dd721ed126cc91bed49eb2c072ba1b25b50048280a4e2c5ed56e59
1114
# steps inspired by "chcolateyInstall.ps1" from "git.install" (https://chocolatey.org/packages/git.install)
1215
RUN Write-Host ('Downloading {0} ...' -f $env:GIT_DOWNLOAD_URL); \
13-
Invoke-WebRequest -Uri $env:GIT_DOWNLOAD_URL -OutFile 'git.exe'; \
16+
Invoke-WebRequest -Uri $env:GIT_DOWNLOAD_URL -OutFile 'git.zip'; \
1417
\
1518
Write-Host ('Verifying sha256 ({0}) ...' -f $env:GIT_DOWNLOAD_SHA256); \
16-
if ((Get-FileHash git.exe -Algorithm sha256).Hash -ne $env:GIT_DOWNLOAD_SHA256) { \
19+
if ((Get-FileHash git.zip -Algorithm sha256).Hash -ne $env:GIT_DOWNLOAD_SHA256) { \
1720
Write-Host 'FAILED!'; \
1821
exit 1; \
1922
}; \
2023
\
21-
Write-Host 'Installing ...'; \
22-
Start-Process \
23-
-Wait \
24-
-FilePath ./git.exe \
25-
# http://www.jrsoftware.org/ishelp/topic_setupcmdline.htm
26-
-ArgumentList @( \
27-
'/VERYSILENT', \
28-
'/NORESTART', \
29-
'/NOCANCEL', \
30-
'/SP-', \
31-
'/SUPPRESSMSGBOXES', \
32-
\
33-
# https://github.com/git-for-windows/build-extra/blob/353f965e0e2af3e8c993930796975f9ce512c028/installer/install.iss#L87-L96
34-
'/COMPONENTS=assoc_sh', \
35-
\
36-
# set "/DIR" so we can set "PATH" afterwards
37-
# 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
38-
'/DIR=C:\git' \
39-
); \
24+
Write-Host 'Expanding ...'; \
25+
Expand-Archive -Path git.zip -DestinationPath C:\git\.; \
26+
\
27+
Write-Host 'Removing ...'; \
28+
Remove-Item git.zip -Force; \
4029
\
4130
Write-Host 'Updating PATH ...'; \
42-
$env:PATH = 'C:\git\bin;C:\git\mingw64\bin;C:\git\usr\bin;' + $env:PATH; \
31+
$env:PATH = 'C:\git\cmd;C:\git\mingw64\bin;C:\git\usr\bin;' + $env:PATH; \
4332
[Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \
4433
\
4534
Write-Host 'Verifying install ...'; \
4635
Write-Host ' git --version'; git --version; \
47-
Write-Host ' bash --version'; bash --version; \
48-
Write-Host ' curl --version'; curl.exe --version; \
49-
\
50-
Write-Host 'Removing installer ...'; \
51-
Remove-Item git.exe -Force; \
5236
\
5337
Write-Host 'Complete.';
5438

0 commit comments

Comments
 (0)