Browse code

update git, hoist powershell setttings to top and use simpler way to get git

Signed-off-by: Michael Friis <friism@gmail.com>

Michael Friis authored on 2017/02/05 16:28:34
Showing 1 changed files
... ...
@@ -156,20 +156,17 @@
156 156
 FROM microsoft/windowsservercore
157 157
 
158 158
 # Use PowerShell as the default shell
159
-SHELL ["powershell", "-command"]
159
+SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
160 160
 
161 161
 # Environment variable notes:
162 162
 #  - GO_VERSION must be consistent with 'Dockerfile' used by Linux.
163 163
 #  - FROM_DOCKERFILE is used for detection of building within a container.
164 164
 ENV GO_VERSION=1.7.5 `
165
-    GIT_VERSION=2.11.0 `
165
+    GIT_VERSION=2.11.1 `
166 166
     GOPATH=C:\go `
167 167
     FROM_DOCKERFILE=1
168 168
 
169 169
 RUN `
170
-  $ErrorActionPreference = 'Stop'; `
171
-  $ProgressPreference = 'SilentlyContinue'; `
172
-  `
173 170
   Function Test-Nano() { `
174 171
     $EditionId = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' -Name 'EditionID').EditionId; `
175 172
     return (($EditionId -eq 'ServerStandardNano') -or ($EditionId -eq 'ServerDataCenterNano') -or ($EditionId -eq 'NanoServer')); `
... ...
@@ -201,11 +198,11 @@ RUN `
201 201
     } `
202 202
   } `
203 203
   `
204
-  setx /M PATH $('C:\git\bin;C:\git\usr\bin;'+$Env:PATH+';C:\gcc\bin;C:\go\bin'); `
204
+  setx /M PATH $('C:\git\cmd;C:\git\usr\bin;'+$Env:PATH+';C:\gcc\bin;C:\go\bin'); `
205 205
   `
206 206
   Write-Host INFO: Downloading git...; `
207
-  $location='https://github.com/git-for-windows/git/releases/download/v'+$env:GIT_VERSION+'.windows.1/PortableGit-'+$env:GIT_VERSION+'-64-bit.7z.exe'; `
208
-  Download-File $location C:\gitsetup.7z.exe; `
207
+  $location='https://www.nuget.org/api/v2/package/GitForWindows/'+$Env:GIT_VERSION; `
208
+  Download-File $location C:\gitsetup.zip; `
209 209
   `
210 210
   Write-Host INFO: Downloading go...; `
211 211
   Download-File $('https://golang.org/dl/go'+$Env:GO_VERSION+'.windows-amd64.zip') C:\go.zip; `
... ...
@@ -219,15 +216,11 @@ RUN `
219 219
   Write-Host INFO: Downloading compiler 3 of 3...; `
220 220
   Download-File https://raw.githubusercontent.com/jhowardmsft/docker-tdmgcc/master/binutils.zip C:\binutils.zip; `
221 221
   `
222
-  Write-Host INFO: Installing PS7Zip package...; `
223
-  Install-Package PS7Zip -Force | Out-Null; `
224
-  Write-Host INFO: Importing PS7Zip...; `
225
-  Import-Module PS7Zip -Force; `
226
-  New-Item C:\git -ItemType Directory | Out-Null ; `
227
-  cd C:\git; `
228 222
   Write-Host INFO: Extracting git...; `
229
-  Expand-7Zip C:\gitsetup.7z.exe | Out-Null; `
230
-  cd C:\; `
223
+  Expand-Archive C:\gitsetup.zip C:\git-tmp; `
224
+  New-Item -Type Directory C:\git | Out-Null; `
225
+  Move-Item C:\git-tmp\tools\* C:\git\.; `
226
+  Remove-Item -Recurse -Force C:\git-tmp; `
231 227
   `
232 228
   Write-Host INFO: Expanding go...; `
233 229
   Expand-Archive C:\go.zip -DestinationPath C:\; `
... ...
@@ -243,13 +236,13 @@ RUN `
243 243
   Remove-Item C:\gcc.zip; `
244 244
   Remove-Item C:\runtime.zip; `
245 245
   Remove-Item C:\binutils.zip; `
246
-  Remove-Item C:\gitsetup.7z.exe; `
246
+  Remove-Item C:\gitsetup.zip; `
247 247
   `
248 248
   Write-Host INFO: Creating source directory...; `
249 249
   New-Item -ItemType Directory -Path C:\go\src\github.com\docker\docker | Out-Null; `
250 250
   `
251 251
   Write-Host INFO: Configuring git core.autocrlf...; `
252
-  C:\git\bin\git config --global core.autocrlf true; `
252
+  C:\git\cmd\git config --global core.autocrlf true; `
253 253
   `
254 254
   Write-Host INFO: Completed
255 255