11FROM mcr.microsoft.com/windows/nanoserver:%%MICROSOFT-TAG%%
22
3- # $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324
4- SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
3+ SHELL ["cmd", "/S", "/C"]
54
65# no Git installed (intentionally)
76# -- Nano Server is "Windows Slim"
@@ -10,34 +9,14 @@ SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPref
109ENV GOPATH C:\\gopath
1110
1211# PATH isn't actually set in the Docker image, so we have to set it from within the container
13- RUN $newPath = ('{0}\bin;C:\go\bin;{1}' -f $env:GOPATH, $env:PATH); \
14- Write-Host ('Updating PATH: {0}' -f $newPath); \
15- # Nano Server does not have "[Environment]::SetEnvironmentVariable()"
16- setx /M PATH $newPath;
12+ USER ContainerAdministrator
13+ RUN setx /m PATH "%GOPATH%\bin;C:\go\bin;%PATH%"
14+ USER ContainerUser
1715# doing this first to share cache across versions more aggressively
1816
1917ENV GOLANG_VERSION %%VERSION%%
2018
21- RUN $url = ('https://golang.org/dl/go{0}.windows-amd64.zip' -f $env:GOLANG_VERSION); \
22- Write-Host ('Downloading {0} ...' -f $url); \
23- Invoke-WebRequest -Uri $url -OutFile 'go.zip'; \
24- \
25- $sha256 = '%%WIN-SHA256%%'; \
26- Write-Host ('Verifying sha256 ({0}) ...' -f $sha256); \
27- if ((Get-FileHash go.zip -Algorithm sha256).Hash -ne $sha256) { \
28- Write-Host 'FAILED!'; \
29- exit 1; \
30- }; \
31- \
32- Write-Host 'Expanding ...'; \
33- Expand-Archive go.zip -DestinationPath C:\; \
34- \
35- Write-Host 'Verifying install ("go version") ...'; \
36- go version; \
37- \
38- Write-Host 'Removing ...'; \
39- Remove-Item go.zip -Force; \
40- \
41- Write-Host 'Complete.';
19+ COPY --from=golang:%%VERSION%%-windowsservercore-%%MICROSOFT-TAG%% C:\\go C:\\go
20+ RUN go version
4221
4322WORKDIR $GOPATH
0 commit comments