ci-images/go-ci/Dockerfile
Peter 398ee8bcf1
All checks were successful
continuous-integration/drone/push Build is passing
Update 'go-ci/Dockerfile'
2023-07-19 20:32:10 +00:00

50 lines
1.9 KiB
Docker

FROM docker.io/golang:1.20-bullseye as tools
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 && \
go install github.com/google/ko@latest
FROM docker.io/ubuntu:22.04
RUN apt-get update && \
apt-get install \
-y \
git-lfs \
curl\
gcc \
jq \
libbpf-dev \
clang \
llvm-13 \
elfutils && \
rm -rf /var/lib/apt/lists/* && \
ln -s /usr/bin/llc-14 /usr/bin/llc
# Install Go
RUN curl -L https://go.dev/dl/go1.20.6.linux-arm64.tar.gz | tar -xz -C /usr/local
ENV PATH=/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
GOPATH=/go
# Install GoReleaser
RUN export GORELEASER_VERSION=$(curl https://api.github.com/repos/goreleaser/goreleaser/releases | jq -r '. | first |.tag_name | capture("(?<version>[[:digit:]]+\\.[[:digit:]]+\\.[[:digit:]]+)") | .version') && \
curl -Lo /tmp/goreleaser.deb "https://github.com/goreleaser/goreleaser/releases/latest/download/goreleaser_${GORELEASER_VERSION}_arm64.deb" && \
apt install /tmp/goreleaser.deb && \
rm -f /tmp/*.deb && \
goreleaser --version
COPY --from=tools /go/bin/* /usr/local/bin/
# Install go tools
RUN curl -L https://github.com/go-task/task/releases/latest/download/task_linux_arm64.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-aarch64" \
&& chmod +x /usr/bin/buf \
&& go version \
&& golangci-lint --version \
&& task --version \
&& buf --version