Skip to content

Commit cb17d92

Browse files
authored
Merge pull request #333 from infosiftr/1.15-rc
Add 1.15beta1
2 parents cd63d15 + 2f3748d commit cb17d92

File tree

6 files changed

+291
-0
lines changed

6 files changed

+291
-0
lines changed

1.15-rc/alpine3.12/Dockerfile

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
FROM alpine:3.12
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.15beta1
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+
armv7) export GOARM='7' ;; \
37+
x86) export GO386='387' ;; \
38+
esac; \
39+
\
40+
wget -O go.tgz "https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz"; \
41+
echo '78cda84d4217ae0fdb8f87848474be28644bdc1aa16579055f852999a4793ac0 *go.tgz' | sha256sum -c -; \
42+
tar -C /usr/local -xzf go.tgz; \
43+
rm go.tgz; \
44+
\
45+
cd /usr/local/go/src; \
46+
./make.bash; \
47+
\
48+
rm -rf \
49+
# https://github.com/golang/go/blob/0b30cf534a03618162d3015c8705dd2231e34703/src/cmd/dist/buildtool.go#L121-L125
50+
/usr/local/go/pkg/bootstrap \
51+
# https://golang.org/cl/82095
52+
# https://github.com/golang/build/blob/e3fe1605c30f6a3fd136b561569933312ede8782/cmd/release/releaselet.go#L56
53+
/usr/local/go/pkg/obj \
54+
; \
55+
apk del .build-deps; \
56+
\
57+
export PATH="/usr/local/go/bin:$PATH"; \
58+
go version
59+
60+
ENV GOPATH /go
61+
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
62+
63+
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
64+
WORKDIR $GOPATH

1.15-rc/buster/Dockerfile

Lines changed: 50 additions & 0 deletions
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.15beta1
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='11814b7475680a09720f3de32c66bca135289c8d528b2e1132b0ce56b3d9d6d7' ;; \
20+
armhf) goRelArch='linux-armv6l'; goRelSha256='d4da5c06097be8d14aeeb45bf8440a05c82e93e6de26063a147a31ed1d901ebc' ;; \
21+
arm64) goRelArch='linux-arm64'; goRelSha256='2648b7d08fe74d0486ec82b3b539d15f3dd63bb34d79e7e57bebc3e5d06b5a38' ;; \
22+
i386) goRelArch='linux-386'; goRelSha256='83d732a3961006e058f44c9672fde93dbea3d1c3d69e8807d135eeaf21fb80c8' ;; \
23+
ppc64el) goRelArch='linux-ppc64le'; goRelSha256='33f7bed5ee9d4a0343dc90a5aa4ec7a1db755d0749b624618c15178fd8df4420' ;; \
24+
s390x) goRelArch='linux-s390x'; goRelSha256='493b4449e68d0deba559e3f23f611310467e4c70d30b3605ff06852f14477457' ;; \
25+
*) goRelArch='src'; goRelSha256='78cda84d4217ae0fdb8f87848474be28644bdc1aa16579055f852999a4793ac0'; \
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.15-rc/release-architectures

Lines changed: 9 additions & 0 deletions
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
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM mcr.microsoft.com/windows/nanoserver:1809
2+
3+
SHELL ["cmd", "/S", "/C"]
4+
5+
# no Git installed (intentionally)
6+
# -- Nano Server is "Windows Slim"
7+
8+
# 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
9+
ENV GOPATH C:\\gopath
10+
11+
# PATH isn't actually set in the Docker image, so we have to set it from within the container
12+
USER ContainerAdministrator
13+
RUN setx /m PATH "%GOPATH%\bin;C:\go\bin;%PATH%"
14+
USER ContainerUser
15+
# doing this first to share cache across versions more aggressively
16+
17+
ENV GOLANG_VERSION 1.15beta1
18+
19+
COPY --from=golang:1.15beta1-windowsservercore-1809 C:\\go C:\\go
20+
RUN go version
21+
22+
WORKDIR $GOPATH
Lines changed: 73 additions & 0 deletions
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.23.0
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 8f65208f92c0b4c3ae4c0cf02d4b5f6791d539cd1a07b2df62b7116467724735
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 ("git version") ...'; \
36+
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.15beta1
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 = '072c7d6a059f76503a2533a20755dddbda58b5053c160cb900271bb039537f88'; \
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 'Removing ...'; \
66+
Remove-Item go.zip -Force; \
67+
\
68+
Write-Host 'Verifying install ("go version") ...'; \
69+
go version; \
70+
\
71+
Write-Host 'Complete.';
72+
73+
WORKDIR $GOPATH
Lines changed: 73 additions & 0 deletions
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.23.0
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 8f65208f92c0b4c3ae4c0cf02d4b5f6791d539cd1a07b2df62b7116467724735
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 ("git version") ...'; \
36+
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.15beta1
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 = '072c7d6a059f76503a2533a20755dddbda58b5053c160cb900271bb039537f88'; \
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 'Removing ...'; \
66+
Remove-Item go.zip -Force; \
67+
\
68+
Write-Host 'Verifying install ("go version") ...'; \
69+
go version; \
70+
\
71+
Write-Host 'Complete.';
72+
73+
WORKDIR $GOPATH

0 commit comments

Comments
 (0)