From d9f7d33a9e31f746836a2bcee8cc3f30d6c7483c Mon Sep 17 00:00:00 2001 From: Peter Kurfer Date: Wed, 12 Oct 2022 19:13:27 +0200 Subject: [PATCH] feat(go): replace Alpine with Debian base --- go-ci/Dockerfile | 51 +++++++++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/go-ci/Dockerfile b/go-ci/Dockerfile index 646fef3..995b01b 100644 --- a/go-ci/Dockerfile +++ b/go-ci/Dockerfile @@ -1,42 +1,39 @@ -FROM docker.io/golang:1.19-alpine +FROM docker.io/golang:1.19-bullseye as tools -# install basic dependencies -RUN apk add -U --no-cache \ - docker \ - protobuf-dev \ - findutils \ - git \ +RUN go install github.com/golang/mock/mockgen@latest && \ + go install github.com/Helcaraxan/gomod@latest && \ + go install gotest.tools/gotestsum@latest && \ + go install golang.org/x/tools/cmd/goimports@latest && \ + go install mvdan.cc/gofumpt@latest && \ + go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest + +FROM docker.io/golang:1.19-bullseye + +RUN apt-get update && \ + apt-get install \ + -y \ git-lfs \ - ca-certificates \ - graphviz \ + curl\ gcc \ - musl-dev \ - curl \ jq \ - libbpf \ libbpf-dev \ clang \ - llvm12 \ - elfutils \ - linux-headers + llvm-13 \ + elfutils && \ + rm -rf /var/lib/apt/lists/* && \ + ln -s /usr/bin/llc-13 /usr/bin/llc # Install GoReleaser RUN export GORELEASER_VERSION=$(curl https://api.github.com/repos/goreleaser/goreleaser/releases | jq -r '. | first |.tag_name | capture("(?[[:digit:]]+\\.[[:digit:]]+\\.[[:digit:]]+)") | .version') && \ - curl -Lo /tmp/goreleaser.apk "https://github.com/goreleaser/goreleaser/releases/latest/download/goreleaser_${GORELEASER_VERSION}_x86_64.apk" && \ - apk add --allow-untrusted /tmp/goreleaser.apk && \ - rm -f /tmp/*.apk && \ +curl -Lo /tmp/goreleaser.deb "https://github.com/goreleaser/goreleaser/releases/latest/download/goreleaser_${GORELEASER_VERSION}_amd64.deb" && \ + apt install /tmp/goreleaser.deb && \ + rm -f /tmp/*.deb && \ goreleaser --version +COPY --from=tools /go/bin/* /usr/local/bin/ + # Install go tools -RUN go install github.com/golang/mock/mockgen@latest \ - && go install google.golang.org/protobuf/cmd/protoc-gen-go@latest \ - && go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest \ - && go install github.com/Helcaraxan/gomod@latest \ - && go install gotest.tools/gotestsum@latest \ - && go install golang.org/x/tools/cmd/goimports@latest \ - && go install mvdan.cc/gofumpt@latest \ - && go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest \ - && curl -L https://github.com/go-task/task/releases/latest/download/task_linux_amd64.tar.gz | tar -xvz -C /usr/local/bin task \ +RUN curl -L https://github.com/go-task/task/releases/latest/download/task_linux_amd64.tar.gz | tar -xvz -C /usr/local/bin task \ && export BUF_VERSION=$(curl https://api.github.com/repos/bufbuild/buf/releases | jq -r '. | first |.tag_name') && \ curl -Lo /usr/bin/buf "https://github.com/bufbuild/buf/releases/download/${BUF_VERSION}/buf-Linux-x86_64" \ && chmod +x /usr/bin/buf \