You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Dockerfile-windows-nanoserver.template
+2-21
Original file line number
Diff line number
Diff line change
@@ -5,39 +5,20 @@ SHELL ["cmd", "/S", "/C"]
5
5
# no Git installed (intentionally)
6
6
# -- Nano Server is "Windows Slim"
7
7
8
-
{{
9
-
def install_directory:
10
-
if [ "1.15", "1.16" ] | index(env.version) then
11
-
"C:\\go"
12
-
else
13
-
"C:\\Program Files\\Go"
14
-
end
15
-
-}}
16
-
{{ if install_directory == "C:\\go" then ( -}}
17
-
# ideally, this would be C:\go to match Linux a bit closer, but C:\go was the default install path for Go itself on Windows
18
-
ENV GOPATH C:\\gopath
19
-
# (https://golang.org/cl/283600)
20
-
{{ ) else ( -}}
21
8
# for 1.17+, we'll follow the (new) Go upstream default for install (https://golang.org/cl/283600), which frees up C:\go to be the default GOPATH and thus match the Linux images more closely (https://github.com/docker-library/golang/issues/288)
22
9
ENV GOPATH C:\\go
23
10
# HOWEVER, please note that it is the Go upstream intention to remove GOPATH support entirely: https://blog.golang.org/go116-module-changes
24
-
{{ ) end -}}
25
11
26
12
# PATH isn't actually set in the Docker image, so we have to set it from within the container
27
13
USER ContainerAdministrator
28
-
RUN setx /m PATH "%GOPATH%\bin;{{ install_directory }}\bin;%PATH%"
14
+
RUN setx /m PATH "%GOPATH%\bin;C:\Program Files\Go\bin;%PATH%"
29
15
USER ContainerUser
30
16
# doing this first to share cache across versions more aggressively
31
17
32
18
ENV GOLANG_VERSION {{ .version }}
33
19
34
20
# Docker's Windows path parsing is absolutely *cursed*; please just trust me on this one -Tianon
# ideally, this would be C:\go to match Linux a bit closer, but C:\go was the default install path for Go itself on Windows
50
-
ENV GOPATH C:\\gopath
51
-
# (https://golang.org/cl/283600)
52
-
{{ ) else ( -}}
53
40
# for 1.17+, we'll follow the (new) Go upstream default for install (https://golang.org/cl/283600), which frees up C:\go to be the default GOPATH and thus match the Linux images more closely (https://github.com/docker-library/golang/issues/288)
54
41
ENV GOPATH C:\\go
55
42
# HOWEVER, please note that it is the Go upstream intention to remove GOPATH support entirely: https://blog.golang.org/go116-module-changes
56
-
{{ ) end -}}
57
43
58
44
# PATH isn't actually set in the Docker image, so we have to set it from within the container
59
-
RUN $newPath = ('{0}\bin;{{ install_directory }}\bin;{1}' -f $env:GOPATH, $env:PATH); \
45
+
RUN $newPath = ('{0}\bin;C:\Program Files\Go\bin;{1}' -f $env:GOPATH, $env:PATH); \
0 commit comments