@@ -7,18 +7,26 @@ ENV OCT_DB_FOLDER=${OCT_FOLDER}/cmd/tnf/fetch/data
77# Install dependencies
88RUN yum install -y gcc git jq make wget
99
10- # Install Go binary
11- ENV GO_DL_URL="https://golang.org/dl"
12- ENV GO_BIN_TAR="go1.22.1.linux-amd64.tar.gz"
13- ENV GO_BIN_URL_x86_64=${GO_DL_URL}/${GO_BIN_TAR}
14- ENV GOPATH="/root/go"
15- RUN if [[ "$(uname -m)" -eq "x86_64" ]] ; then \
16- wget --directory-prefix=${TEMP_DIR} ${GO_BIN_URL_x86_64} && \
17- rm -rf /usr/local/go && \
18- tar -C /usr/local -xzf ${TEMP_DIR}/${GO_BIN_TAR}; \
19- else \
20- echo "CPU architecture not supported" && exit 1; \
21- fi
10+ # Install Go binary and set the PATH
11+ ENV \
12+ GO_DL_URL=https://golang.org/dl \
13+ GOPATH=/root/go
14+ ENV GO_BIN_URL_x86_64=${GO_DL_URL}/go1.22.1.linux-amd64.tar.gz
15+ ENV GO_BIN_URL_aarch64=${GO_DL_URL}/go1.22.1.linux-arm64.tar.gz
16+
17+ # Determine the CPU architecture and download the appropriate Go binary
18+ RUN \
19+ if [ "$(uname -m)" = x86_64 ]; then \
20+ wget --directory-prefix=${TEMP_DIR} ${GO_BIN_URL_x86_64} --quiet \
21+ && rm -rf /usr/local/go \
22+ && tar -C /usr/local -xzf ${TEMP_DIR}/go1.22.1.linux-amd64.tar.gz; \
23+ elif [ "$(uname -m)" = aarch64 ]; then \
24+ wget --directory-prefix=${TEMP_DIR} ${GO_BIN_URL_aarch64} --quiet \
25+ && rm -rf /usr/local/go \
26+ && tar -C /usr/local -xzf ${TEMP_DIR}/go1.22.1.linux-arm64.tar.gz; \
27+ else \
28+ echo "CPU architecture is not supported." && exit 1; \
29+ fi
2230
2331# Add go binary directory to $PATH
2432ENV PATH=${PATH}:"/usr/local/go/bin" :${GOPATH}/"bin"
0 commit comments