From 3e135854edd374f36069a2caa97f13eba4a11e55 Mon Sep 17 00:00:00 2001 From: Neur0toxine Date: Fri, 5 Aug 2022 16:36:10 +0300 Subject: [PATCH] fix possible failure after 1.18 updated & add 1.19 --- .github/workflows/buildx.yml | 6 ++ .github/workflows/dockerimage.yml | 2 + .github/workflows/hadolint.yml | 4 +- 1.18-3.13/Dockerfile | 2 - 1.19-3.13/Dockerfile | 101 ++++++++++++++++++++++++++++++ 1.19/Dockerfile | 10 +++ 6 files changed, 121 insertions(+), 4 deletions(-) create mode 100644 1.19-3.13/Dockerfile create mode 100644 1.19/Dockerfile diff --git a/.github/workflows/buildx.yml b/.github/workflows/buildx.yml index 7264ab3..dd5a25e 100644 --- a/.github/workflows/buildx.yml +++ b/.github/workflows/buildx.yml @@ -31,6 +31,12 @@ jobs: - path: 1.18-3.13 tags: "1.18-3.13" platforms: linux/amd64,linux/arm64,linux/386 + - path: 1.19 + tags: "1.19" + platforms: linux/amd64,linux/arm64,linux/386 + - path: 1.19-3.13 + tags: "1.19-3.13" + platforms: linux/amd64,linux/arm64,linux/386 steps: - name: Checkout diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml index 919a8d0..9ffe293 100644 --- a/.github/workflows/dockerimage.yml +++ b/.github/workflows/dockerimage.yml @@ -15,3 +15,5 @@ jobs: docker run -i $(docker build -q 1.17-3.13) /bin/sh -c "go version && bash --version && make --version && git --version && gcc --version && jq --version && curl --version && air -v && dlv version && which gocov && go-junit-report -version && dumb-init --version" docker run -i $(docker build -q 1.18) /bin/sh -c "go version && bash --version && make --version && git --version && gcc --version && jq --version && curl --version && air -v && dlv version && which gocov && go-junit-report -version && dumb-init --version" docker run -i $(docker build -q 1.18-3.13) /bin/sh -c "go version && bash --version && make --version && git --version && gcc --version && jq --version && curl --version && air -v && dlv version && which gocov && go-junit-report -version && dumb-init --version" + docker run -i $(docker build -q 1.19) /bin/sh -c "go version && bash --version && make --version && git --version && gcc --version && jq --version && curl --version && air -v && dlv version && which gocov && go-junit-report -version && dumb-init --version" + docker run -i $(docker build -q 1.19-3.13) /bin/sh -c "go version && bash --version && make --version && git --version && gcc --version && jq --version && curl --version && air -v && dlv version && which gocov && go-junit-report -version && dumb-init --version" diff --git a/.github/workflows/hadolint.yml b/.github/workflows/hadolint.yml index c2f2e1a..7308791 100644 --- a/.github/workflows/hadolint.yml +++ b/.github/workflows/hadolint.yml @@ -10,5 +10,5 @@ jobs: - run: brew install hadolint - name: Lint Dockerfiles run: | - hadolint {1.16,1.16-3.13,1.17,1.17-3.13,1.18}/Dockerfile - hadolint --ignore=DL3047 --ignore=DL3059 --ignore=DL4001 --ignore=SC2155 1.18-3.13/Dockerfile + hadolint {1.16,1.16-3.13,1.17,1.17-3.13,1.18,1.19}/Dockerfile + hadolint --ignore=DL3047 --ignore=DL3059 --ignore=DL4001 --ignore=SC2155 {1.18-3.13/Dockerfile,1.19-3.13/Dockerfile} diff --git a/1.18-3.13/Dockerfile b/1.18-3.13/Dockerfile index aacf8bc..c26149e 100644 --- a/1.18-3.13/Dockerfile +++ b/1.18-3.13/Dockerfile @@ -34,12 +34,10 @@ RUN set -eux; \ esac; \ # https://github.com/golang/go/issues/38536#issuecomment-616897960 url="https://dl.google.com/go/$GOVERSION.src.tar.gz"; \ - sha256='4525aa6b0e3cecb57845f4060a7075aafc9ab752bb7b6b4cf8a212d43078e1e4'; \ # the precompiled binaries published by Go upstream are not compatible with Alpine, so we always build from source here 😅 \ 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; \ diff --git a/1.19-3.13/Dockerfile b/1.19-3.13/Dockerfile new file mode 100644 index 0000000..e2e842c --- /dev/null +++ b/1.19-3.13/Dockerfile @@ -0,0 +1,101 @@ +FROM alpine:3.13 + +ENV PATH /usr/local/go/bin:$PATH + +RUN set -eux; \ + apk add --no-cache ca-certificates jq curl; \ + ([ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf); \ + apk add --no-cache --virtual .fetch-deps gnupg; \ + arch="$(apk --print-arch)"; \ + export GOVERSION="$(curl -fsSL 'https://go.dev/dl/?mode=json&include=1.19' | jq -r '.[0].version')"; \ + 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 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; \ +# https://github.com/golang/go/issues/38536#issuecomment-616897960 + url="https://dl.google.com/go/$GOVERSION.src.tar.gz"; \ +# the precompiled binaries published by Go upstream are not compatible with Alpine, so we always build from source here 😅 + \ + wget -O go.tgz.asc "$url.asc"; \ + wget -O go.tgz "$url"; \ + \ +# 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; \ + \ + apk add --no-cache --virtual .build-deps \ + bash \ + gcc \ + 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" \ + ; \ + \ + apk del --no-network .fetch-deps; \ + \ + go version + +ENV GOPATH /go +ENV PATH $GOPATH/bin:$PATH +RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH" +WORKDIR $GOPATH + +RUN set -eux; \ + apk add --no-cache bash make git gcc libc-dev dumb-init && \ + go install github.com/go-delve/delve/cmd/dlv@latest && \ + go install github.com/cosmtrek/air@latest && \ + go install github.com/jstemmer/go-junit-report@latest && \ + go install github.com/axw/gocov/gocov@latest && \ + chmod -R 777 "$GOPATH" +WORKDIR / +ENTRYPOINT ["/usr/bin/dumb-init", "--"] diff --git a/1.19/Dockerfile b/1.19/Dockerfile new file mode 100644 index 0000000..2c52d15 --- /dev/null +++ b/1.19/Dockerfile @@ -0,0 +1,10 @@ +FROM golang:1.19-alpine +RUN set -eux; \ + apk add --no-cache bash make git gcc libc-dev jq curl dumb-init && \ + go install github.com/go-delve/delve/cmd/dlv@latest && \ + go install github.com/cosmtrek/air@latest && \ + go install github.com/jstemmer/go-junit-report@latest && \ + go install github.com/axw/gocov/gocov@latest && \ + chmod -R 777 "$GOPATH" +WORKDIR / +ENTRYPOINT ["/usr/bin/dumb-init", "--"]