Browse code

Windows: dockerfile tweaks

Signed-off-by: John Howard <jhoward@microsoft.com>

John Howard authored on 2016/10/31 05:57:40
Showing 1 changed files
... ...
@@ -41,8 +41,8 @@
41 41
 #
42 42
 # 1. Clone the sources from github.com:
43 43
 #
44
-#    >>   git clone https://github.com/docker/docker.git c:\go\src\github.com\docker\docker
45
-#    >>   Cloning into 'c:\go\src\github.com\docker\docker'...
44
+#    >>   git clone https://github.com/docker/docker.git C:\go\src\github.com\docker\docker
45
+#    >>   Cloning into 'C:\go\src\github.com\docker\docker'...
46 46
 #    >>   remote: Counting objects: 186216, done.
47 47
 #    >>   remote: Compressing objects: 100% (21/21), done.
48 48
 #    >>   remote: Total 186216 (delta 5), reused 0 (delta 0), pack-reused 186195
... ...
@@ -55,7 +55,7 @@
55 55
 #
56 56
 # 2. Change directory to the cloned docker sources:
57 57
 #
58
-#    >>   cd c:\go\src\github.com\docker\docker 
58
+#    >>   cd C:\go\src\github.com\docker\docker 
59 59
 #
60 60
 #
61 61
 # 3. Build a docker image with the components required to build the docker binaries from source:
... ...
@@ -72,9 +72,9 @@
72 72
 #    folder on the host system where you want the binaries to be located.
73 73
 #
74 74
 #    >>   $v=$(Get-Content ".\VERSION" -raw).ToString().Replace("`n","").Trim()
75
-#    >>   docker cp binaries:c:\go\src\github.com\docker\docker\bundles\$v\binary-client\docker-$v.exe c:\HostPath\docker.exe
76
-#    >>   docker cp binaries:c:\go\src\github.com\docker\docker\bundles\$v\binary-daemon\dockerd.exe c:\HostPath\dockerd.exe
77
-#    >>   docker cp binaries:c:\go\src\github.com\docker\docker\bundles\$v\binary-daemon\docker-proxy-$v.exe c:\HostPath\docker-proxy.exe
75
+#    >>   docker cp binaries:C:\go\src\github.com\docker\docker\bundles\$v\binary-client\docker-$v.exe C:\HostPath\docker.exe
76
+#    >>   docker cp binaries:C:\go\src\github.com\docker\docker\bundles\$v\binary-daemon\dockerd.exe C:\HostPath\dockerd.exe
77
+#    >>   docker cp binaries:C:\go\src\github.com\docker\docker\bundles\$v\binary-daemon\docker-proxy-$v.exe C:\HostPath\docker-proxy.exe
78 78
 #
79 79
 #
80 80
 # 6. (Optional) Remove the interim container holding the built executable binaries:
... ...
@@ -118,30 +118,33 @@
118 118
 # The number of build steps below are explicitly minimised to improve performance.
119 119
 FROM microsoft/windowsservercore
120 120
 
121
+# Use PowerShell as the default shell
122
+SHELL ["powershell", "-command"]
123
+
121 124
 # Environment variable notes:
122
-#  - GO_VERSION must consistent with 'Dockerfile' used by Linux'.
125
+#  - GO_VERSION must be consistent with 'Dockerfile' used by Linux.
123 126
 #  - FROM_DOCKERFILE is used for detection of building within a container.
124 127
 ENV GO_VERSION=1.7.3 `
125 128
     GIT_LOCATION=https://github.com/git-for-windows/git/releases/download/v2.10.1.windows.1/Git-2.10.1-64-bit.exe `
126
-    GOPATH=C:/go;C:/go/src/github.com/docker/docker/vendor `
129
+    GOPATH=C:\go;C:\go\src\github.com\docker\docker\vendor `
130
+    GOROOT=C:\go `
127 131
     FROM_DOCKERFILE=1
128 132
 
129
-WORKDIR c:/
133
+WORKDIR C:\
130 134
 
131 135
 RUN `
132
- setx /M Path "%Path%;c:\gcc\bin;c:\go\bin;" && `
133
- setx GOROOT "c:\go" && `
134
- powershell -command `
136
+  setx /M Path $($Env:PATH+';C:\gcc\bin;C:\go\bin'); `
137
+  `
135 138
   $ErrorActionPreference = 'Stop'; `
136 139
   Function Download-File([string] $source, [string] $target) { `
137
-   $wc = New-Object net.webclient; $wc.Downloadfile($source, $target) `
140
+    $wc = New-Object net.webclient; $wc.Downloadfile($source, $target) `
138 141
   } `
139 142
   `
140 143
   Write-Host INFO: Downloading git...; `
141
-  Download-File %GIT_LOCATION% gitsetup.exe; `
144
+  Download-File $Env:GIT_LOCATION gitsetup.exe; `
142 145
   `
143 146
   Write-Host INFO: Downloading go...; `
144
-  Download-File https://golang.org/dl/go%GO_VERSION%.windows-amd64.zip go.zip; `
147
+  Download-File $('https://golang.org/dl/go'+$Env:GO_VERSION+'.windows-amd64.zip') go.zip; `
145 148
   `
146 149
   Write-Host INFO: Downloading compiler 1 of 3...; `
147 150
   Download-File https://raw.githubusercontent.com/jhowardmsft/docker-tdmgcc/master/gcc.zip gcc.zip; `
... ...
@@ -160,18 +163,18 @@ RUN `
160 160
   New-ItemProperty $installKey -Name 'Inno Setup CodeFile: Path Option' -Value 'CmdTools' -PropertyType 'String' -Force; `
161 161
   New-ItemProperty $installKey -Name 'Inno Setup CodeFile: Bash Terminal Option' -Value 'ConHost' -PropertyType 'String' -Force; `
162 162
   New-ItemProperty $installKey -Name 'Inno Setup CodeFile: CRLF Option' -Value 'CRLFCommitAsIs' -PropertyType 'String' -Force; `
163
-  Start-Process gitsetup.exe -ArgumentList '/VERYSILENT /SUPPRESSMSGBOXES /CLOSEAPPLICATIONS /DIR=c:\git\' -Wait; `
163
+  Start-Process gitsetup.exe -ArgumentList '/VERYSILENT /SUPPRESSMSGBOXES /CLOSEAPPLICATIONS /DIR=C:\git\' -Wait; `
164 164
   `
165
-  Write-Host INFO: Expanding go..."; `
166
-  Expand-Archive c:\go.zip -DestinationPath c:\; `
165
+  Write-Host INFO: Expanding go...; `
166
+  Expand-Archive C:\go.zip -DestinationPath C:\; `
167 167
   `
168 168
   Write-Host INFO: Expanding compiler...; `
169
-  Expand-Archive c:\gcc.zip -DestinationPath c:\gcc -Force; `
170
-  Expand-Archive c:\runtime.zip -DestinationPath c:\gcc -Force; `
171
-  Expand-Archive c:\binutils.zip -DestinationPath c:\gcc -Force; `
169
+  Expand-Archive C:\gcc.zip -DestinationPath C:\gcc -Force; `
170
+  Expand-Archive C:\runtime.zip -DestinationPath C:\gcc -Force; `
171
+  Expand-Archive C:\binutils.zip -DestinationPath C:\gcc -Force; `
172 172
   `
173 173
   Write-Host INFO: Completed
174 174
 
175 175
 # Prepare for building
176
-COPY . /go/src/github.com/docker/docker
176
+COPY . C:\go\src\github.com\docker\docker
177 177