From b328d6348c869ce7450c443ecad95399923c1b00 Mon Sep 17 00:00:00 2001
From: "DESKTOP-ONSRM5U\\ly"
Date: Fri, 24 Jun 2022 16:41:27 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9EgolangV1.14=E7=89=88=E6=9C=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
1.14/Dockerfile | 107 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 107 insertions(+)
create mode 100644 1.14/Dockerfile
diff --git a/1.14/Dockerfile b/1.14/Dockerfile
new file mode 100644
index 0000000..b6da7df
--- /dev/null
+++ b/1.14/Dockerfile
@@ -0,0 +1,107 @@
+FROM repository.anxinyun.cn/devops/alpine:3-tz-hw
+
+RUN apk add --no-cache ca-certificates gcc g++
+
+# set up nsswitch.conf for Go's "netgo" implementation
+# - https://github.com/golang/go/blob/go1.9.1/src/net/conf.go#L194-L275
+# - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf
+RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
+
+ENV PATH /usr/local/go/bin:$PATH
+
+ENV GOLANG_VERSION 1.14.15
+
+RUN set -eux; \
+ apk add --no-cache --virtual .fetch-deps gnupg; \
+ arch="$(apk --print-arch)"; \
+ url=; \
+ case "$arch" in \
+ 'x86_64') \
+ export GOAMD64='v1' GOARCH='amd64' GOOS='linux'; \
+ ;; \
+ 'armhf') \
+ export GOARCH='arm' GOARM='6' GOOS='linux'; \
+ ;; \
+ 'armv7') \
+ export GOARCH='arm' GOARM='7' GOOS='linux'; \
+ ;; \
+ 'aarch64') \
+ export GOARCH='arm64' GOOS='linux'; \
+ ;; \
+ 'x86') \
+ export GO386='softfloat' GOARCH='386' GOOS='linux'; \
+ ;; \
+ 'ppc64le') \
+ export GOARCH='ppc64le' GOOS='linux'; \
+ ;; \
+ 's390x') \
+ export GOARCH='s390x' GOOS='linux'; \
+ ;; \
+ *) echo >&2 "error: unsupported architecture '$arch' (likely packaging update needed)"; exit 1 ;; \
+ esac; \
+ build=; \
+ if [ -z "$url" ]; then \
+# https://github.com/golang/go/issues/38536#issuecomment-616897960
+ build=1; \
+ url='https://dl.google.com/go/go1.18.2.src.tar.gz'; \
+ sha256='2c44d03ea2c34092137ab919ba602f2c261a038d08eb468528a3f3a28e5667e2'; \
+# the precompiled binaries published by Go upstream are not compatible with Alpine, so we always build from source here ������
+ fi; \
+ \
+ wget -O go.tgz.asc "$url.asc"; \
+ wget -O go.tgz "$url"; \
+ echo "$sha256 *go.tgz" | sha256sum -c -; \
+ \
+# https://github.com/golang/go/issues/14739#issuecomment-324767697
+ GNUPGHOME="$(mktemp -d)"; export GNUPGHOME; \
+# https://www.google.com/linuxrepositories/
+ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 'EB4C 1BFD 4F04 2F6D DDCC EC91 7721 F63B D38B 4796'; \
+# let's also fetch the specific subkey of that key explicitly that we expect "go.tgz.asc" to be signed by, just to make sure we definitely have it
+ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys '2F52 8D36 D67B 69ED F998 D857 78BD 6547 3CB3 BD13'; \
+ gpg --batch --verify go.tgz.asc go.tgz; \
+ gpgconf --kill all; \
+ rm -rf "$GNUPGHOME" go.tgz.asc; \
+ \
+ tar -C /usr/local -xzf go.tgz; \
+ rm go.tgz; \
+ \
+ if [ -n "$build" ]; then \
+ apk add --no-cache --virtual .build-deps \
+ bash \
+ go \
+ musl-dev \
+ ; \
+ \
+ export GOCACHE='/tmp/gocache'; \
+ \
+ ( \
+ cd /usr/local/go/src; \
+# set GOROOT_BOOTSTRAP + GOHOST* such that we can build Go successfully
+ export GOROOT_BOOTSTRAP="$(go env GOROOT)" GOHOSTOS="$GOOS" GOHOSTARCH="$GOARCH"; \
+ ./make.bash; \
+ ); \
+ \
+ apk del --no-network .build-deps; \
+ \
+# remove a few intermediate / bootstrapping files the official binary release tarballs do not contain
+ rm -rf \
+ /usr/local/go/pkg/*/cmd \
+ /usr/local/go/pkg/bootstrap \
+ /usr/local/go/pkg/obj \
+ /usr/local/go/pkg/tool/*/api \
+ /usr/local/go/pkg/tool/*/go_bootstrap \
+ /usr/local/go/src/cmd/dist/dist \
+ "$GOCACHE" \
+ ; \
+ fi; \
+ \
+ apk del --no-network .fetch-deps; \
+ \
+ go version
+
+ENV GOPATH="/go" \
+ GOPROXY="https://goproxy.cn,direct"
+
+ENV PATH $GOPATH/bin:$PATH
+RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
+WORKDIR $GOPATH