From c8d9d397711c5d3345ddf1c2838a48cb27bbebcd Mon Sep 17 00:00:00 2001 From: Ray Date: Fri, 27 Dec 2019 11:45:39 +0800 Subject: [PATCH 1/4] go 1.13.4 --- Dockerfile | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index c3cfb9f..b1ed78d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,12 @@ -FROM docker:18-git +FROM docker:19-git -ENV GO111MODULE off +ENV GO111MODULE on ENV GOPATH /go ENV GOBIN "${GOPATH}/bin" ENV PATH "${GOBIN}:${PATH}" -RUN apk update && apk add --no-cache go=1.12.12-r0 alpine-sdk && apk upgrade && \ +RUN apk update && apk add --no-cache go=1.13.4-r1 alpine-sdk && apk upgrade && \ mkdir -p ${GOBIN} && \ - mkdir -p ~/.ssh && chmod 0700 ~/.ssh && \ - curl -s https://glide.sh/get | sh && \ - curl -s https://raw.githubusercontent.com/golang/dep/master/install.sh | sh && \ go get github.com/huanteng/pgdiff && \ go clean -cache -testcache -modcache && \ rm -rf ${GOPATH}/src/* && \ From e6bc3eaeec5fc00c6ad14f20c85533e9d0d635d7 Mon Sep 17 00:00:00 2001 From: Ray Date: Fri, 27 Dec 2019 12:06:22 +0800 Subject: [PATCH 2/4] added bash --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b1ed78d..f347a6f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ ENV GOPATH /go ENV GOBIN "${GOPATH}/bin" ENV PATH "${GOBIN}:${PATH}" -RUN apk update && apk add --no-cache go=1.13.4-r1 alpine-sdk && apk upgrade && \ +RUN apk update && apk add --no-cache go=1.13.4-r1 alpine-sdk bash && apk upgrade && \ mkdir -p ${GOBIN} && \ go get github.com/huanteng/pgdiff && \ go clean -cache -testcache -modcache && \ From 6a97faf10e3da932981712826fc9178aeafe4ff8 Mon Sep 17 00:00:00 2001 From: Ray Date: Fri, 6 Mar 2020 11:10:02 +0800 Subject: [PATCH 3/4] update go --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f347a6f..fafaf02 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ ENV GOPATH /go ENV GOBIN "${GOPATH}/bin" ENV PATH "${GOBIN}:${PATH}" -RUN apk update && apk add --no-cache go=1.13.4-r1 alpine-sdk bash && apk upgrade && \ +RUN apk update && apk add --no-cache go=1.13.8-r0 alpine-sdk bash && apk upgrade && \ mkdir -p ${GOBIN} && \ go get github.com/huanteng/pgdiff && \ go clean -cache -testcache -modcache && \ From 91ba5d0658ba0aa3c749ffa4f070bb489bafac74 Mon Sep 17 00:00:00 2001 From: Rui Wang Date: Tue, 21 Apr 2020 08:59:07 +0800 Subject: [PATCH 4/4] 1.13.10 --- Dockerfile | 75 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 64 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index fafaf02..9864653 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,66 @@ -FROM docker:19-git +FROM docker:18-git + +RUN apk add --no-cache \ + ca-certificates + +# 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 GOLANG_VERSION 1.13.10 + +RUN set -eux; \ + apk add --no-cache --virtual .build-deps \ + bash \ + gcc \ + musl-dev \ + openssl \ + go \ + ; \ + export \ +# set GOROOT_BOOTSTRAP such that we can actually build Go + GOROOT_BOOTSTRAP="$(go env GOROOT)" \ +# ... and set "cross-building" related vars to the installed system's values so that we create a build targeting the proper arch +# (for example, if our build host is GOARCH=amd64, but our build env/image is GOARCH=386, our build needs GOARCH=386) + GOOS="$(go env GOOS)" \ + GOARCH="$(go env GOARCH)" \ + GOHOSTOS="$(go env GOHOSTOS)" \ + GOHOSTARCH="$(go env GOHOSTARCH)" \ + ; \ +# also explicitly set GO386 and GOARM if appropriate +# https://github.com/docker-library/golang/issues/184 + apkArch="$(apk --print-arch)"; \ + case "$apkArch" in \ + armhf) export GOARM='6' ;; \ + armv7) export GOARM='7' ;; \ + x86) export GO386='387' ;; \ + esac; \ + \ + wget -O go.tgz "https://dl.google.com/go/go$GOLANG_VERSION.src.tar.gz"; \ + echo 'eb9ccc8bf59ed068e7eff73e154e4f5ee7eec0a47a610fb864e3332a2fdc8b8c *go.tgz' | sha256sum -c -; \ + tar -C /usr/local -xzf go.tgz; \ + rm go.tgz; \ + \ + cd /usr/local/go/src; \ + ./make.bash; \ + \ + rm -rf \ +# https://github.com/golang/go/blob/0b30cf534a03618162d3015c8705dd2231e34703/src/cmd/dist/buildtool.go#L121-L125 + /usr/local/go/pkg/bootstrap \ +# https://golang.org/cl/82095 +# https://github.com/golang/build/blob/e3fe1605c30f6a3fd136b561569933312ede8782/cmd/release/releaselet.go#L56 + /usr/local/go/pkg/obj \ + ; \ + apk del .build-deps; \ + \ + export PATH="/usr/local/go/bin:$PATH"; \ + go version -ENV GO111MODULE on ENV GOPATH /go -ENV GOBIN "${GOPATH}/bin" -ENV PATH "${GOBIN}:${PATH}" - -RUN apk update && apk add --no-cache go=1.13.8-r0 alpine-sdk bash && apk upgrade && \ - mkdir -p ${GOBIN} && \ - go get github.com/huanteng/pgdiff && \ - go clean -cache -testcache -modcache && \ - rm -rf ${GOPATH}/src/* && \ - rm -rf /tmp/* +ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH + +RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH" +WORKDIR $GOPATH + +RUN go get github.com/huanteng/pgdiff && go clean -cache -testcache -modcache \ No newline at end of file