Skip to content

Commit fc23a77

Browse files
authored
Merge pull request #287 from infosiftr/go1.13
Add Go 1.13
2 parents 9a2b18f + a8b5183 commit fc23a77

File tree

10 files changed

+354
-3
lines changed

10 files changed

+354
-3
lines changed

.appveyor.yml

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ image: Visual Studio 2017
33

44
environment:
55
matrix:
6+
- version: 1.13-rc
7+
variant: windowsservercore-ltsc2016
68
- version: 1.12
79
variant: windowsservercore-ltsc2016
810
- version: 1.11

.travis.yml

+7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ services: docker
33

44
matrix:
55
include:
6+
- os: windows
7+
dist: 1803-containers
8+
env: VERSION=1.13-rc VARIANT=windows/windowsservercore-1803
9+
- os: linux
10+
env: VERSION=1.13-rc VARIANT=buster
11+
- os: linux
12+
env: VERSION=1.13-rc VARIANT=alpine3.10
613
- os: windows
714
dist: 1803-containers
815
env: VERSION=1.12 VARIANT=windows/windowsservercore-1803

1.13-rc/alpine3.10/Dockerfile

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
FROM alpine:3.10
2+
3+
RUN apk add --no-cache \
4+
ca-certificates
5+
6+
# set up nsswitch.conf for Go's "netgo" implementation
7+
# - https://github.com/golang/go/blob/go1.9.1/src/net/conf.go#L194-L275
8+
# - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf
9+
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
10+
11+
ENV GOLANG_VERSION 1.13beta1
12+
13+
RUN set -eux; \
14+
apk add --no-cache --virtual .build-deps \
15+
bash \
16+
gcc \
17+
musl-dev \
18+
openssl \
19+
go \
20+
; \
21+
export \
22+
# set GOROOT_BOOTSTRAP such that we can actually build Go
23+
GOROOT_BOOTSTRAP="$(go env GOROOT)" \
24+
# ... and set "cross-building" related vars to the installed system's values so that we create a build targeting the proper arch
25+
# (for example, if our build host is GOARCH=amd64, but our build env/image is GOARCH=386, our build needs GOARCH=386)
26+
GOOS="$(go env GOOS)" \
27+
GOARCH="$(go env GOARCH)" \
28+
GOHOSTOS="$(go env GOHOSTOS)" \
29+
GOHOSTARCH="$(go env GOHOSTARCH)" \
30+
; \
31+
# also explicitly set GO386 and GOARM if appropriate
32+
# https://github.com/docker-library/golang/issues/184
33+
apkArch="$(apk --print-arch)"; \
34+
case "$apkArch" in \
35+
armhf) export GOARM='6' ;; \
36+
x86) export GO386='387' ;; \
37+
esac; \
38+
\
39+
wget -O go.tgz "https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz"; \
40+
echo 'e8a7c504cd6775b8a6af101158b8871455918c9a61162f0180f7a9f118dc4102 *go.tgz' | sha256sum -c -; \
41+
tar -C /usr/local -xzf go.tgz; \
42+
rm go.tgz; \
43+
\
44+
cd /usr/local/go/src; \
45+
./make.bash; \
46+
\
47+
rm -rf \
48+
# https://github.com/golang/go/blob/0b30cf534a03618162d3015c8705dd2231e34703/src/cmd/dist/buildtool.go#L121-L125
49+
/usr/local/go/pkg/bootstrap \
50+
# https://golang.org/cl/82095
51+
# https://github.com/golang/build/blob/e3fe1605c30f6a3fd136b561569933312ede8782/cmd/release/releaselet.go#L56
52+
/usr/local/go/pkg/obj \
53+
; \
54+
apk del .build-deps; \
55+
\
56+
export PATH="/usr/local/go/bin:$PATH"; \
57+
go version
58+
59+
ENV GOPATH /go
60+
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
61+
62+
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
63+
WORKDIR $GOPATH

1.13-rc/buster/Dockerfile

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
FROM buildpack-deps:buster-scm
2+
3+
# gcc for cgo
4+
RUN apt-get update && apt-get install -y --no-install-recommends \
5+
g++ \
6+
gcc \
7+
libc6-dev \
8+
make \
9+
pkg-config \
10+
&& rm -rf /var/lib/apt/lists/*
11+
12+
ENV GOLANG_VERSION 1.13beta1
13+
14+
RUN set -eux; \
15+
\
16+
# this "case" statement is generated via "update.sh"
17+
dpkgArch="$(dpkg --print-architecture)"; \
18+
case "${dpkgArch##*-}" in \
19+
amd64) goRelArch='linux-amd64'; goRelSha256='dbd131c92f381a5bc5ca1f0cfd942cb8be7d537007b6f412b5be41ff38a7d0d9' ;; \
20+
armhf) goRelArch='linux-armv6l'; goRelSha256='77993f1dce5b4d080cbd06a4553e5e1c6caa7ad6817ea3c62254b89d6f079504' ;; \
21+
arm64) goRelArch='linux-arm64'; goRelSha256='298a325d8eeba561a26312a9cdc821a96873c10fca7f48a7f98bbd8848bd8bd4' ;; \
22+
i386) goRelArch='linux-386'; goRelSha256='38039e4f7b6eea8f55e91d90607150d5d397f9063c06445c45009dd1e6dba8cc' ;; \
23+
ppc64el) goRelArch='linux-ppc64le'; goRelSha256='0f3c5c7b7956911ed8d1fc4e9dbeb2584d0be695c5c15b528422e3bb2d5989f0' ;; \
24+
s390x) goRelArch='linux-s390x'; goRelSha256='877065ac7d1729e5de1bbfe1e712788bf9dee5613a5502cf0ba76e65c2521b26' ;; \
25+
*) goRelArch='src'; goRelSha256='e8a7c504cd6775b8a6af101158b8871455918c9a61162f0180f7a9f118dc4102'; \
26+
echo >&2; echo >&2 "warning: current architecture ($dpkgArch) does not have a corresponding Go binary release; will be building from source"; echo >&2 ;; \
27+
esac; \
28+
\
29+
url="https://golang.org/dl/go${GOLANG_VERSION}.${goRelArch}.tar.gz"; \
30+
wget -O go.tgz "$url"; \
31+
echo "${goRelSha256} *go.tgz" | sha256sum -c -; \
32+
tar -C /usr/local -xzf go.tgz; \
33+
rm go.tgz; \
34+
\
35+
if [ "$goRelArch" = 'src' ]; then \
36+
echo >&2; \
37+
echo >&2 'error: UNIMPLEMENTED'; \
38+
echo >&2 'TODO install golang-any from jessie-backports for GOROOT_BOOTSTRAP (and uninstall after build)'; \
39+
echo >&2; \
40+
exit 1; \
41+
fi; \
42+
\
43+
export PATH="/usr/local/go/bin:$PATH"; \
44+
go version
45+
46+
ENV GOPATH /go
47+
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
48+
49+
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
50+
WORKDIR $GOPATH

1.13-rc/release-architectures

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# see https://golang.org/dl/
2+
3+
# bashbrew-arch dpkg-arch golang-release-arch
4+
amd64 amd64 amd64
5+
arm32v7 armhf armv6l
6+
arm64v8 arm64 arm64
7+
i386 i386 386
8+
ppc64le ppc64el ppc64le
9+
s390x s390x s390x
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
FROM mcr.microsoft.com/windows/servercore:1803
2+
3+
# $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324
4+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
5+
6+
# install MinGit (especially for "go get")
7+
# https://blogs.msdn.microsoft.com/visualstudioalm/2016/09/03/whats-new-in-git-for-windows-2-10/
8+
# "Essentially, it is a Git for Windows that was stripped down as much as possible without sacrificing the functionality in which 3rd-party software may be interested."
9+
# "It currently requires only ~45MB on disk."
10+
ENV GIT_VERSION 2.11.1
11+
ENV GIT_TAG v${GIT_VERSION}.windows.1
12+
ENV GIT_DOWNLOAD_URL https://github.com/git-for-windows/git/releases/download/${GIT_TAG}/MinGit-${GIT_VERSION}-64-bit.zip
13+
ENV GIT_DOWNLOAD_SHA256 668d16a799dd721ed126cc91bed49eb2c072ba1b25b50048280a4e2c5ed56e59
14+
# steps inspired by "chcolateyInstall.ps1" from "git.install" (https://chocolatey.org/packages/git.install)
15+
RUN Write-Host ('Downloading {0} ...' -f $env:GIT_DOWNLOAD_URL); \
16+
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
17+
Invoke-WebRequest -Uri $env:GIT_DOWNLOAD_URL -OutFile 'git.zip'; \
18+
\
19+
Write-Host ('Verifying sha256 ({0}) ...' -f $env:GIT_DOWNLOAD_SHA256); \
20+
if ((Get-FileHash git.zip -Algorithm sha256).Hash -ne $env:GIT_DOWNLOAD_SHA256) { \
21+
Write-Host 'FAILED!'; \
22+
exit 1; \
23+
}; \
24+
\
25+
Write-Host 'Expanding ...'; \
26+
Expand-Archive -Path git.zip -DestinationPath C:\git\.; \
27+
\
28+
Write-Host 'Removing ...'; \
29+
Remove-Item git.zip -Force; \
30+
\
31+
Write-Host 'Updating PATH ...'; \
32+
$env:PATH = 'C:\git\cmd;C:\git\mingw64\bin;C:\git\usr\bin;' + $env:PATH; \
33+
[Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \
34+
\
35+
Write-Host 'Verifying install ...'; \
36+
Write-Host ' git --version'; git --version; \
37+
\
38+
Write-Host 'Complete.';
39+
40+
# 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
41+
ENV GOPATH C:\\gopath
42+
43+
# PATH isn't actually set in the Docker image, so we have to set it from within the container
44+
RUN $newPath = ('{0}\bin;C:\go\bin;{1}' -f $env:GOPATH, $env:PATH); \
45+
Write-Host ('Updating PATH: {0}' -f $newPath); \
46+
[Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine);
47+
# doing this first to share cache across versions more aggressively
48+
49+
ENV GOLANG_VERSION 1.13beta1
50+
51+
RUN $url = ('https://golang.org/dl/go{0}.windows-amd64.zip' -f $env:GOLANG_VERSION); \
52+
Write-Host ('Downloading {0} ...' -f $url); \
53+
Invoke-WebRequest -Uri $url -OutFile 'go.zip'; \
54+
\
55+
$sha256 = '08098b4b0e1a105971d2fced2842e806f8ffa08973ae8781fd22dd90f76404fb'; \
56+
Write-Host ('Verifying sha256 ({0}) ...' -f $sha256); \
57+
if ((Get-FileHash go.zip -Algorithm sha256).Hash -ne $sha256) { \
58+
Write-Host 'FAILED!'; \
59+
exit 1; \
60+
}; \
61+
\
62+
Write-Host 'Expanding ...'; \
63+
Expand-Archive go.zip -DestinationPath C:\; \
64+
\
65+
Write-Host 'Verifying install ("go version") ...'; \
66+
go version; \
67+
\
68+
Write-Host 'Removing ...'; \
69+
Remove-Item go.zip -Force; \
70+
\
71+
Write-Host 'Complete.';
72+
73+
WORKDIR $GOPATH
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
FROM mcr.microsoft.com/windows/servercore:1809
2+
3+
# $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324
4+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
5+
6+
# install MinGit (especially for "go get")
7+
# https://blogs.msdn.microsoft.com/visualstudioalm/2016/09/03/whats-new-in-git-for-windows-2-10/
8+
# "Essentially, it is a Git for Windows that was stripped down as much as possible without sacrificing the functionality in which 3rd-party software may be interested."
9+
# "It currently requires only ~45MB on disk."
10+
ENV GIT_VERSION 2.11.1
11+
ENV GIT_TAG v${GIT_VERSION}.windows.1
12+
ENV GIT_DOWNLOAD_URL https://github.com/git-for-windows/git/releases/download/${GIT_TAG}/MinGit-${GIT_VERSION}-64-bit.zip
13+
ENV GIT_DOWNLOAD_SHA256 668d16a799dd721ed126cc91bed49eb2c072ba1b25b50048280a4e2c5ed56e59
14+
# steps inspired by "chcolateyInstall.ps1" from "git.install" (https://chocolatey.org/packages/git.install)
15+
RUN Write-Host ('Downloading {0} ...' -f $env:GIT_DOWNLOAD_URL); \
16+
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
17+
Invoke-WebRequest -Uri $env:GIT_DOWNLOAD_URL -OutFile 'git.zip'; \
18+
\
19+
Write-Host ('Verifying sha256 ({0}) ...' -f $env:GIT_DOWNLOAD_SHA256); \
20+
if ((Get-FileHash git.zip -Algorithm sha256).Hash -ne $env:GIT_DOWNLOAD_SHA256) { \
21+
Write-Host 'FAILED!'; \
22+
exit 1; \
23+
}; \
24+
\
25+
Write-Host 'Expanding ...'; \
26+
Expand-Archive -Path git.zip -DestinationPath C:\git\.; \
27+
\
28+
Write-Host 'Removing ...'; \
29+
Remove-Item git.zip -Force; \
30+
\
31+
Write-Host 'Updating PATH ...'; \
32+
$env:PATH = 'C:\git\cmd;C:\git\mingw64\bin;C:\git\usr\bin;' + $env:PATH; \
33+
[Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \
34+
\
35+
Write-Host 'Verifying install ...'; \
36+
Write-Host ' git --version'; git --version; \
37+
\
38+
Write-Host 'Complete.';
39+
40+
# 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
41+
ENV GOPATH C:\\gopath
42+
43+
# PATH isn't actually set in the Docker image, so we have to set it from within the container
44+
RUN $newPath = ('{0}\bin;C:\go\bin;{1}' -f $env:GOPATH, $env:PATH); \
45+
Write-Host ('Updating PATH: {0}' -f $newPath); \
46+
[Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine);
47+
# doing this first to share cache across versions more aggressively
48+
49+
ENV GOLANG_VERSION 1.13beta1
50+
51+
RUN $url = ('https://golang.org/dl/go{0}.windows-amd64.zip' -f $env:GOLANG_VERSION); \
52+
Write-Host ('Downloading {0} ...' -f $url); \
53+
Invoke-WebRequest -Uri $url -OutFile 'go.zip'; \
54+
\
55+
$sha256 = '08098b4b0e1a105971d2fced2842e806f8ffa08973ae8781fd22dd90f76404fb'; \
56+
Write-Host ('Verifying sha256 ({0}) ...' -f $sha256); \
57+
if ((Get-FileHash go.zip -Algorithm sha256).Hash -ne $sha256) { \
58+
Write-Host 'FAILED!'; \
59+
exit 1; \
60+
}; \
61+
\
62+
Write-Host 'Expanding ...'; \
63+
Expand-Archive go.zip -DestinationPath C:\; \
64+
\
65+
Write-Host 'Verifying install ("go version") ...'; \
66+
go version; \
67+
\
68+
Write-Host 'Removing ...'; \
69+
Remove-Item go.zip -Force; \
70+
\
71+
Write-Host 'Complete.';
72+
73+
WORKDIR $GOPATH
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
FROM mcr.microsoft.com/windows/servercore:ltsc2016
2+
3+
# $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324
4+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
5+
6+
# install MinGit (especially for "go get")
7+
# https://blogs.msdn.microsoft.com/visualstudioalm/2016/09/03/whats-new-in-git-for-windows-2-10/
8+
# "Essentially, it is a Git for Windows that was stripped down as much as possible without sacrificing the functionality in which 3rd-party software may be interested."
9+
# "It currently requires only ~45MB on disk."
10+
ENV GIT_VERSION 2.11.1
11+
ENV GIT_TAG v${GIT_VERSION}.windows.1
12+
ENV GIT_DOWNLOAD_URL https://github.com/git-for-windows/git/releases/download/${GIT_TAG}/MinGit-${GIT_VERSION}-64-bit.zip
13+
ENV GIT_DOWNLOAD_SHA256 668d16a799dd721ed126cc91bed49eb2c072ba1b25b50048280a4e2c5ed56e59
14+
# steps inspired by "chcolateyInstall.ps1" from "git.install" (https://chocolatey.org/packages/git.install)
15+
RUN Write-Host ('Downloading {0} ...' -f $env:GIT_DOWNLOAD_URL); \
16+
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
17+
Invoke-WebRequest -Uri $env:GIT_DOWNLOAD_URL -OutFile 'git.zip'; \
18+
\
19+
Write-Host ('Verifying sha256 ({0}) ...' -f $env:GIT_DOWNLOAD_SHA256); \
20+
if ((Get-FileHash git.zip -Algorithm sha256).Hash -ne $env:GIT_DOWNLOAD_SHA256) { \
21+
Write-Host 'FAILED!'; \
22+
exit 1; \
23+
}; \
24+
\
25+
Write-Host 'Expanding ...'; \
26+
Expand-Archive -Path git.zip -DestinationPath C:\git\.; \
27+
\
28+
Write-Host 'Removing ...'; \
29+
Remove-Item git.zip -Force; \
30+
\
31+
Write-Host 'Updating PATH ...'; \
32+
$env:PATH = 'C:\git\cmd;C:\git\mingw64\bin;C:\git\usr\bin;' + $env:PATH; \
33+
[Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \
34+
\
35+
Write-Host 'Verifying install ...'; \
36+
Write-Host ' git --version'; git --version; \
37+
\
38+
Write-Host 'Complete.';
39+
40+
# 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
41+
ENV GOPATH C:\\gopath
42+
43+
# PATH isn't actually set in the Docker image, so we have to set it from within the container
44+
RUN $newPath = ('{0}\bin;C:\go\bin;{1}' -f $env:GOPATH, $env:PATH); \
45+
Write-Host ('Updating PATH: {0}' -f $newPath); \
46+
[Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine);
47+
# doing this first to share cache across versions more aggressively
48+
49+
ENV GOLANG_VERSION 1.13beta1
50+
51+
RUN $url = ('https://golang.org/dl/go{0}.windows-amd64.zip' -f $env:GOLANG_VERSION); \
52+
Write-Host ('Downloading {0} ...' -f $url); \
53+
Invoke-WebRequest -Uri $url -OutFile 'go.zip'; \
54+
\
55+
$sha256 = '08098b4b0e1a105971d2fced2842e806f8ffa08973ae8781fd22dd90f76404fb'; \
56+
Write-Host ('Verifying sha256 ({0}) ...' -f $sha256); \
57+
if ((Get-FileHash go.zip -Algorithm sha256).Hash -ne $sha256) { \
58+
Write-Host 'FAILED!'; \
59+
exit 1; \
60+
}; \
61+
\
62+
Write-Host 'Expanding ...'; \
63+
Expand-Archive go.zip -DestinationPath C:\; \
64+
\
65+
Write-Host 'Verifying install ("go version") ...'; \
66+
go version; \
67+
\
68+
Write-Host 'Removing ...'; \
69+
Remove-Item go.zip -Force; \
70+
\
71+
Write-Host 'Complete.';
72+
73+
WORKDIR $GOPATH

generate-stackbrew-library.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ declare -A aliases=(
66
[1.13-rc]='rc'
77
)
88

9-
defaultDebianSuite='stretch'
9+
defaultDebianSuite='stretch' # TODO buster
1010
declare -A debianSuite=(
11+
[1.13-rc]='buster'
1112
)
1213
defaultAlpineVersion='3.10'
1314
declare -A alpineVersion=(
@@ -72,7 +73,7 @@ for version in "${versions[@]}"; do
7273
)
7374

7475
for v in \
75-
stretch alpine{3.10,3.9} \
76+
buster stretch alpine{3.10,3.9} \
7677
windows/windowsservercore-{ltsc2016,1803,1809} \
7778
windows/nanoserver-{1803,1809} \
7879
; do

update.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ for version in "${versions[@]}"; do
8585

8686
for variant in \
8787
alpine{3.9,3.10} \
88-
stretch \
88+
stretch buster \
8989
; do
9090
if [ -d "$version/$variant" ]; then
9191
tag="$variant"

0 commit comments

Comments
 (0)