@@ -29,71 +29,11 @@ FROM ${KONG_BASE}
2929
3030USER root
3131
32+ # Install Google Cloud SQL Proxy
3233RUN apk add --no-cache \
33- git \
34- ca-certificates
35-
36- # set up nsswitch.conf for Go's "netgo" implementation
37- # - https://github.com/golang/go/blob/go1.9.1/src/net/conf.go#L194-L275
38- # - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf
39- RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
40-
41- ENV GOLANG_VERSION 1.14.4
42-
43- RUN set -eux; \
44- apk add --no-cache --virtual .build-deps \
45- bash \
46- gcc \
47- musl-dev \
48- openssl \
49- go \
50- ; \
51- export \
52- # set GOROOT_BOOTSTRAP such that we can actually build Go
53- GOROOT_BOOTSTRAP="$(go env GOROOT)" \
54- # ... and set "cross-building" related vars to the installed system's values so that we create a build targeting the proper arch
55- # (for example, if our build host is GOARCH=amd64, but our build env/image is GOARCH=386, our build needs GOARCH=386)
56- GOOS="$(go env GOOS)" \
57- GOARCH="$(go env GOARCH)" \
58- GOHOSTOS="$(go env GOHOSTOS)" \
59- GOHOSTARCH="$(go env GOHOSTARCH)" \
60- ; \
61- # also explicitly set GO386 and GOARM if appropriate
62- # https://github.com/docker-library/golang/issues/184
63- apkArch="$(apk --print-arch)" ; \
64- case "$apkArch" in \
65- armhf) export GOARM='6' ;; \
66- armv7) export GOARM='7' ;; \
67- x86) export GO386='387' ;; \
68- esac; \
69- \
70- wget -O go.tgz "https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz" ; \
71- echo '7011af3bbc2ac108d1b82ea8abb87b2e63f78844f0259be20cde4d42c5c40584 *go.tgz' | sha256sum -c -; \
72- tar -C /usr/local -xzf go.tgz; \
73- rm go.tgz; \
74- \
75- cd /usr/local/go/src; \
76- ./make.bash; \
77- \
78- rm -rf \
79- # https://github.com/golang/go/blob/0b30cf534a03618162d3015c8705dd2231e34703/src/cmd/dist/buildtool.go#L121-L125
80- /usr/local/go/pkg/bootstrap \
81- # https://golang.org/cl/82095
82- # https://github.com/golang/build/blob/e3fe1605c30f6a3fd136b561569933312ede8782/cmd/release/releaselet.go#L56
83- /usr/local/go/pkg/obj \
84- ; \
85- apk del .build-deps; \
86- \
87- export PATH="/usr/local/go/bin:$PATH" ; \
88- go version
89-
90- ENV GOPATH /go
91- ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
92-
93- RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
94-
95- # Install Google Cloud SQL Proxy from source
96- RUN go get github.com/GoogleCloudPlatform/cloudsql-proxy/cmd/cloud_sql_proxy
34+ wget \
35+ && wget https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 -O /usr/bin/cloud_sql_proxy \
36+ && chmod +x /usr/bin/cloud_sql_proxy
9737
9838# Rename default response headers (rename "Kong" to "Gateway")
9939RUN sed -i s/"X-Kong/" X-Gateway/g /usr/local/share/lua/5.1/kong/constants.lua
0 commit comments