Skip to content

Commit 10e5e8a

Browse files
Merge pull request #138 from StefanScherer/build-golang-devel
Build devel version of Golang to test fix for #18555
2 parents d1c01ef + a5bf5f9 commit 10e5e8a

5 files changed

Lines changed: 43 additions & 3 deletions

File tree

golang/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ FROM golang:1.8-nanoserver
22

33
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
44

5-
ENV GIT_VERSION 2.12.0
6-
ENV GIT_DOWNLOAD_URL https://github.com/git-for-windows/git/releases/download/v${GIT_VERSION}.windows.1/MinGit-${GIT_VERSION}-64-bit.zip
7-
ENV GIT_SHA256 6238f65c4d8412b993cb092efde4954f8cb7da4def54d0c1533835f00e83fdad
5+
ENV GIT_VERSION 2.12.2
6+
ENV GIT_DOWNLOAD_URL https://github.com/git-for-windows/git/releases/download/v${GIT_VERSION}.windows.2/MinGit-${GIT_VERSION}.2-64-bit.zip
7+
ENV GIT_SHA256 3918cd9ab42c9a22aa3934463fdb536485c84e6876e9aaab74003deb43a08a36
88

99
RUN Invoke-WebRequest -UseBasicParsing $env:GIT_DOWNLOAD_URL -OutFile git.zip; \
1010
if ((Get-FileHash git.zip -Algorithm sha256).Hash -ne $env:GIT_SHA256) {exit 1} ; \

golang/Dockerfile.devel

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
FROM golang:1.8-windowsservercore AS build
2+
RUN mv /go /go1.8.1
3+
WORKDIR /
4+
RUN git clone https://github.com/golang/go
5+
WORKDIR /go/src
6+
ENV GOROOT_BOOTSTRAP C:/go1.8.1
7+
ENV CGO_ENABLED 0
8+
RUN cmd /C make.bat
9+
10+
FROM microsoft/nanoserver
11+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
12+
ENV GOPATH C:\\gopath
13+
RUN $newPath = ('{0}\bin;C:\go\bin;{1}' -f $env:GOPATH, $env:PATH); \
14+
Write-Host ('Updating PATH: {0}' -f $newPath); \
15+
setx /M PATH $newPath;
16+
COPY --from=build /go /go
17+
WORKDIR $GOPATH
18+
19+
ENV GIT_VERSION 2.12.2
20+
ENV GIT_DOWNLOAD_URL https://github.com/git-for-windows/git/releases/download/v${GIT_VERSION}.windows.2/MinGit-${GIT_VERSION}.2-64-bit.zip
21+
ENV GIT_SHA256 3918cd9ab42c9a22aa3934463fdb536485c84e6876e9aaab74003deb43a08a36
22+
23+
RUN Invoke-WebRequest -UseBasicParsing $env:GIT_DOWNLOAD_URL -OutFile git.zip; \
24+
if ((Get-FileHash git.zip -Algorithm sha256).Hash -ne $env:GIT_SHA256) {exit 1} ; \
25+
Expand-Archive git.zip -DestinationPath C:\git; \
26+
Remove-Item git.zip; \
27+
Write-Host 'Updating PATH ...'; \
28+
$env:PATH = 'C:\git\cmd;C:\git\mingw64\bin;C:\git\usr\bin;' + $env:PATH; \
29+
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH

golang/build.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1+
. $PSScriptRoot\..\update-docker-ce.ps1
2+
13
docker build -t golang .
4+
docker build -t golang:devel -f Dockerfile.devel .

golang/push.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@ docker tag golang stefanscherer/golang-windows:1.8
22
docker tag golang stefanscherer/golang-windows
33
docker push stefanscherer/golang-windows:1.8
44
docker push stefanscherer/golang-windows
5+
6+
docker tag golang:devel stefanscherer/golang-windows:devel
7+
docker push stefanscherer/golang-windows:devel

golang/test.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
1+
Write-Host Testing golang image
12
docker run golang go version
23
docker run golang git --version
4+
5+
Write-Host Testing golang:devel image
6+
docker run golang:devel go version
7+
docker run golang:devel git --version

0 commit comments

Comments
 (0)