Skip to content

Commit 78572cc

Browse files
committedSep 9, 2024··
Fix gotools for non-amd64
1 parent 73c922d commit 78572cc

File tree

2 files changed

+59
-6
lines changed

2 files changed

+59
-6
lines changed
 

‎docker/Dockerfile.acmesh-golang

+2-6
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,11 @@ RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" \
2929
&& echo "====> ${TARGETPLATFORM}: $(go version)"
3030

3131
WORKDIR /root
32-
3332
COPY ./files/.bashrc.acmesh-golang /root/.bashrc
3433

3534
# Gotools
36-
RUN cd /usr && wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.56.2
37-
RUN go install github.com/kyoh86/richgo@latest \
38-
&& go install github.com/mfridman/tparse@latest \
39-
&& go install golang.org/x/vuln/cmd/govulncheck@latest \
40-
&& rm -rf /root/.cache/go-build
35+
COPY ./scripts/install-gotools /tmp/install-gotools
36+
RUN /tmp/install-gotools
4137

4238
LABEL org.label-schema.cmd="docker run --rm -ti nginxproxymanager/nginx-full:acmesh-golang"
4339

‎scripts/install-gotools

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/bin/bash
2+
set -e
3+
4+
BLUE='\E[1;34m'
5+
CYAN='\E[1;36m'
6+
YELLOW='\E[1;33m'
7+
GREEN='\E[1;32m'
8+
RESET='\E[0m'
9+
10+
GSA_VERSION=$(curl -sSfL "https://api.github.com/repos/Zxilly/go-size-analyzer/releases/latest" | jq -r '.tag_name')
11+
12+
# Determine the correct binary file for the architecture given
13+
case $TARGETPLATFORM in
14+
linux/arm64)
15+
ARCH=arm64
16+
;;
17+
18+
linux/arm/v7)
19+
ARCH=arm
20+
;;
21+
22+
*)
23+
ARCH=amd64
24+
;;
25+
esac
26+
27+
if [ "$ARCH" = "amd64" ]; then
28+
echo -e "${BLUE}${CYAN}Installing golangci-lint ...${RESET}"
29+
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
30+
31+
echo -e "${BLUE}${CYAN}Installing richgo ...${RESET}"
32+
go install github.com/kyoh86/richgo@latest
33+
34+
echo -e "${BLUE}${CYAN}Installing govulncheck ...${RESET}"
35+
go install golang.org/x/vuln/cmd/govulncheck@latest
36+
37+
echo -e "${BLUE}${CYAN}Installing tparse ...${RESET}"
38+
go install github.com/mfridman/tparse@latest
39+
40+
echo -e "${BLUE}${CYAN}Installing go-junit-report ...${RESET}"
41+
go install github.com/jstemmer/go-junit-report@latest
42+
43+
echo -e "${BLUE}${CYAN}Installing go-test-coverage ...${RESET}"
44+
go install github.com/vladopajic/go-test-coverage/v2@latest
45+
46+
echo -e "${BLUE}${CYAN}Installing go-size-analyzer ...${RESET}"
47+
wget -O "/tmp/go-size-analyzer_linux_${ARCH}.tar.gz" "https://github.com/Zxilly/go-size-analyzer/releases/download/${GSA_VERSION}/go-size-analyzer_linux_${ARCH}.tar.gz"
48+
cd /usr/bin/
49+
tar -xzf "/tmp/go-size-analyzer_linux_${ARCH}.tar.gz" gsa
50+
rm -rf "/tmp/go-size-analyzer_linux_${ARCH}.tar.gz"
51+
52+
echo -e "${BLUE}${CYAN}Installing go-mod-upgrade ...${RESET}"
53+
go install github.com/oligot/go-mod-upgrade@latest
54+
fi
55+
56+
rm -rf "$(go env GOPATH)/.cache/go-build"
57+
echo -e "${BLUE}${GREEN}Tools install completed${RESET}"

0 commit comments

Comments
 (0)
Please sign in to comment.