Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ script:
# TODO make the tests run successfully on Windows too!
docker run --rm "$image" go version
docker run --rm "$image" git --version
# if we've got nanoserver, let's build test that too
nanoserverDir="../nanoserver-${VARIANT#windows/windowsservercore-}"
if [ -f "$nanoserverDir/Dockerfile" ]; then
nanoserverImage="${image//windowsservercore/nanoserver}"
nanoserverFromWindows="$(awk -F '[ =]' '$1 == "COPY" && $2 == "--from" { print $3; exit }' "$nanoserverDir/Dockerfile")" # match "COPY --from=..." value
docker tag "$image" "$nanoserverFromWindows"
docker build -t "$nanoserverImage" "$nanoserverDir"
docker run --rm "$nanoserverImage" go version
fi
else
~/official-images/test/run.sh "$image"
fi
Expand Down
22 changes: 22 additions & 0 deletions 1.11/windows/nanoserver-1803/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM mcr.microsoft.com/windows/nanoserver:1803

SHELL ["cmd", "/S", "/C"]

# no Git installed (intentionally)
# -- Nano Server is "Windows Slim"

# ideally, this would be C:\go to match Linux a bit closer, but C:\go is the recommended install path for Go itself on Windows
ENV GOPATH C:\\gopath

# PATH isn't actually set in the Docker image, so we have to set it from within the container
USER ContainerAdministrator
RUN setx /m PATH "%GOPATH%\bin;C:\go\bin;%PATH%"
USER ContainerUser
# doing this first to share cache across versions more aggressively

ENV GOLANG_VERSION 1.11.12

COPY --from=golang:1.11.12-windowsservercore-1803 C:\\go C:\\go
RUN go version

WORKDIR $GOPATH
22 changes: 22 additions & 0 deletions 1.11/windows/nanoserver-1809/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM mcr.microsoft.com/windows/nanoserver:1809

SHELL ["cmd", "/S", "/C"]

# no Git installed (intentionally)
# -- Nano Server is "Windows Slim"

# ideally, this would be C:\go to match Linux a bit closer, but C:\go is the recommended install path for Go itself on Windows
ENV GOPATH C:\\gopath

# PATH isn't actually set in the Docker image, so we have to set it from within the container
USER ContainerAdministrator
RUN setx /m PATH "%GOPATH%\bin;C:\go\bin;%PATH%"
USER ContainerUser
# doing this first to share cache across versions more aggressively

ENV GOLANG_VERSION 1.11.12

COPY --from=golang:1.11.12-windowsservercore-1809 C:\\go C:\\go
RUN go version

WORKDIR $GOPATH
22 changes: 22 additions & 0 deletions 1.12/windows/nanoserver-1803/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM mcr.microsoft.com/windows/nanoserver:1803

SHELL ["cmd", "/S", "/C"]

# no Git installed (intentionally)
# -- Nano Server is "Windows Slim"

# ideally, this would be C:\go to match Linux a bit closer, but C:\go is the recommended install path for Go itself on Windows
ENV GOPATH C:\\gopath

# PATH isn't actually set in the Docker image, so we have to set it from within the container
USER ContainerAdministrator
RUN setx /m PATH "%GOPATH%\bin;C:\go\bin;%PATH%"
USER ContainerUser
# doing this first to share cache across versions more aggressively

ENV GOLANG_VERSION 1.12.7

COPY --from=golang:1.12.7-windowsservercore-1803 C:\\go C:\\go
RUN go version

WORKDIR $GOPATH
22 changes: 22 additions & 0 deletions 1.12/windows/nanoserver-1809/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM mcr.microsoft.com/windows/nanoserver:1809

SHELL ["cmd", "/S", "/C"]

# no Git installed (intentionally)
# -- Nano Server is "Windows Slim"

# ideally, this would be C:\go to match Linux a bit closer, but C:\go is the recommended install path for Go itself on Windows
ENV GOPATH C:\\gopath

# PATH isn't actually set in the Docker image, so we have to set it from within the container
USER ContainerAdministrator
RUN setx /m PATH "%GOPATH%\bin;C:\go\bin;%PATH%"
USER ContainerUser
# doing this first to share cache across versions more aggressively

ENV GOLANG_VERSION 1.12.7

COPY --from=golang:1.12.7-windowsservercore-1809 C:\\go C:\\go
RUN go version

WORKDIR $GOPATH
22 changes: 22 additions & 0 deletions 1.13-rc/windows/nanoserver-1803/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM mcr.microsoft.com/windows/nanoserver:1803

SHELL ["cmd", "/S", "/C"]

# no Git installed (intentionally)
# -- Nano Server is "Windows Slim"

# ideally, this would be C:\go to match Linux a bit closer, but C:\go is the recommended install path for Go itself on Windows
ENV GOPATH C:\\gopath

# PATH isn't actually set in the Docker image, so we have to set it from within the container
USER ContainerAdministrator
RUN setx /m PATH "%GOPATH%\bin;C:\go\bin;%PATH%"
USER ContainerUser
# doing this first to share cache across versions more aggressively

ENV GOLANG_VERSION 1.13beta1

COPY --from=golang:1.13beta1-windowsservercore-1803 C:\\go C:\\go
RUN go version

WORKDIR $GOPATH
22 changes: 22 additions & 0 deletions 1.13-rc/windows/nanoserver-1809/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM mcr.microsoft.com/windows/nanoserver:1809

SHELL ["cmd", "/S", "/C"]

# no Git installed (intentionally)
# -- Nano Server is "Windows Slim"

# ideally, this would be C:\go to match Linux a bit closer, but C:\go is the recommended install path for Go itself on Windows
ENV GOPATH C:\\gopath

# PATH isn't actually set in the Docker image, so we have to set it from within the container
USER ContainerAdministrator
RUN setx /m PATH "%GOPATH%\bin;C:\go\bin;%PATH%"
USER ContainerUser
# doing this first to share cache across versions more aggressively

ENV GOLANG_VERSION 1.13beta1

COPY --from=golang:1.13beta1-windowsservercore-1809 C:\\go C:\\go
RUN go version

WORKDIR $GOPATH
33 changes: 6 additions & 27 deletions Dockerfile-windows-nanoserver.template
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
FROM mcr.microsoft.com/windows/nanoserver:%%MICROSOFT-TAG%%

# $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
SHELL ["cmd", "/S", "/C"]

# no Git installed (intentionally)
# -- Nano Server is "Windows Slim"
Expand All @@ -10,34 +9,14 @@ SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPref
ENV GOPATH C:\\gopath

# PATH isn't actually set in the Docker image, so we have to set it from within the container
RUN $newPath = ('{0}\bin;C:\go\bin;{1}' -f $env:GOPATH, $env:PATH); \
Write-Host ('Updating PATH: {0}' -f $newPath); \
# Nano Server does not have "[Environment]::SetEnvironmentVariable()"
setx /M PATH $newPath;
USER ContainerAdministrator
RUN setx /m PATH "%GOPATH%\bin;C:\go\bin;%PATH%"
USER ContainerUser
# doing this first to share cache across versions more aggressively

ENV GOLANG_VERSION %%VERSION%%

RUN $url = ('https://golang.org/dl/go{0}.windows-amd64.zip' -f $env:GOLANG_VERSION); \
Write-Host ('Downloading {0} ...' -f $url); \
Invoke-WebRequest -Uri $url -OutFile 'go.zip'; \
\
$sha256 = '%%WIN-SHA256%%'; \
Write-Host ('Verifying sha256 ({0}) ...' -f $sha256); \
if ((Get-FileHash go.zip -Algorithm sha256).Hash -ne $sha256) { \
Write-Host 'FAILED!'; \
exit 1; \
}; \
\
Write-Host 'Expanding ...'; \
Expand-Archive go.zip -DestinationPath C:\; \
\
Write-Host 'Verifying install ("go version") ...'; \
go version; \
\
Write-Host 'Removing ...'; \
Remove-Item go.zip -Force; \
\
Write-Host 'Complete.';
COPY --from=golang:%%VERSION%%-windowsservercore-%%MICROSOFT-TAG%% C:\\go C:\\go
RUN go version

WORKDIR $GOPATH
1 change: 1 addition & 0 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ for version in "${versions[@]}"; do
"Dockerfile-windows-${winVariant%%-*}.template" > "$version/windows/$winVariant/Dockerfile"

case "$winVariant" in
nanoserver-*) ;; # nanoserver images COPY --from=...:...-windowsservercore-...
*-1803) travisEnv='\n - os: windows\n dist: 1803-containers\n env: VERSION='"$version VARIANT=windows/$winVariant$travisEnv" ;;
*-1809) ;; # no AppVeyor or Travis support for 1809: https://github.com/appveyor/ci/issues/1885 and https://github.com/appveyor/ci/issues/2676
*) appveyorEnv='\n - version: '"$version"'\n variant: '"$winVariant$appveyorEnv" ;;
Expand Down