Created
September 29, 2021 18:46
-
-
Save foucault/5d8fe1b328d19890ce321095eff10350 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM docker.io/debian:buster-slim | |
RUN set -eux; \ | |
apt-get update; \ | |
apt-get install -y --no-install-recommends \ | |
ca-certificates \ | |
wget \ | |
gnupg \ | |
; \ | |
rm -rf /var/lib/apt/lists/* | |
ENV PATH /usr/local/go/bin:$PATH | |
ENV GOLANG_VERSION 1.17.1 | |
RUN set -eux; \ | |
arch="$(dpkg --print-architecture)"; arch="${arch##*-}"; \ | |
url=; \ | |
case "$arch" in \ | |
'amd64') \ | |
url='https://dl.google.com/go/go1.17.1.linux-amd64.tar.gz'; \ | |
sha256='dab7d9c34361dc21ec237d584590d72500652e7c909bf082758fb63064fca0ef'; \ | |
;; \ | |
'armhf') \ | |
url='https://dl.google.com/go/go1.17.1.linux-armv6l.tar.gz'; \ | |
sha256='ed3e4dbc9b80353f6482c441d65b51808290e94ff1d15d56da5f4a7be7353758'; \ | |
;; \ | |
'arm64') \ | |
url='https://dl.google.com/go/go1.17.1.linux-arm64.tar.gz'; \ | |
sha256='53b29236fa03ed862670a5e5e2ab2439a2dc288fe61544aa392062104ac0128c'; \ | |
;; \ | |
'i386') \ | |
url='https://dl.google.com/go/go1.17.1.linux-386.tar.gz'; \ | |
sha256='e60bb44046f424ba2cc47db7b183079b5add2f8cfa6887daf45bf2f317cc2f53'; \ | |
;; \ | |
*) echo >&2 "Unsupported architecture '$arch'"; exit 1 ;; \ | |
esac; \ | |
\ | |
wget -O go.tgz.asc "$url.asc"; \ | |
wget -O go.tgz "$url" --progress=dot:giga; \ | |
echo "$sha256 *go.tgz" | sha256sum -c -; \ | |
GNUPGHOME="$(mktemp -d)"; export GNUPGHOME; \ | |
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 'EB4C 1BFD 4F04 2F6D DDCC EC91 7721 F63B D38B 4796'; \ | |
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; \ | |
apt-get remove gnupg wget -y ; \ | |
apt-get clean; \ | |
apt-get autoremove -y; \ | |
\ | |
go version | |
ENV GOPATH /go | |
ENV PATH $GOPATH/bin:$PATH | |
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH" | |
WORKDIR $GOPATH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment