From 4cda0381a81c56fba8c1457900c37858c85909e0 Mon Sep 17 00:00:00 2001 From: Shinji-IkariG Date: Wed, 10 Jan 2024 16:32:00 +0800 Subject: [PATCH] add golang --- README.md | 3 ++- build/Makefile | 7 +++---- docker/Makefile | 11 +++++------ docker/buildx/centos-7.Dockerfile | 13 +++++++++++++ docker/buildx/centos-8.Dockerfile | 14 +++++++++++++- docker/buildx/rockylinux-8.Dockerfile | 13 +++++++++++++ docker/buildx/ubuntu-2004.Dockerfile | 13 +++++++++++++ 7 files changed, 62 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index fbb6c7d..e2ac603 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ * jemalloc * ldap * libcurl + * libdwarf * libevent * libunwind * lz4 @@ -86,7 +87,7 @@ The docker-based build is for building pre-built packages of third parties. For ```shell # Print all targets $ make -C $path/build print -centos-7 centos-8 ubuntu-1604 ubuntu-1804 ubuntu-2004 ubuntu-2110 ubuntu-2204 +centos-7 centos-8 rockylinux-8 ubuntu-1604 ubuntu-1804 ubuntu-2004 ubuntu-2204 # Build specific target $ make -C $path/build centos-7 diff --git a/build/Makefile b/build/Makefile index 9d9df8a..6132356 100644 --- a/build/Makefile +++ b/build/Makefile @@ -1,5 +1,4 @@ -arch=$(shell uname -m) -tags=centos-7 centos-8 ubuntu-1604 ubuntu-1804 ubuntu-2004 ubuntu-2110 ubuntu-2204 +tags=centos-7 centos-8 rockylinux-8 ubuntu-1604 ubuntu-1804 ubuntu-2004 ubuntu-2204 all: $(tags) @@ -21,5 +20,5 @@ ifneq ($(USE_GCC_VERSIONS),) endif %: - @echo '******************' Build Nebula Third Party For $*-$(arch) '********************' - @$(docker_cmd) --rm -it vesoft/third-party-build:$*-$(arch) ./run.sh + @echo '******************' Build Nebula Third Party For $* '********************' + @$(docker_cmd) --rm -it vesoft/third-party-build:$* ./run.sh diff --git a/docker/Makefile b/docker/Makefile index 62291a5..879bb29 100644 --- a/docker/Makefile +++ b/docker/Makefile @@ -1,5 +1,4 @@ -arch=$(shell uname -m) -tags=centos-7 centos-8 ubuntu-1604 ubuntu-1804 ubuntu-2004 ubuntu-2010 +tags=centos-7 centos-8 rockylinux-8 ubuntu-1604 ubuntu-1804 ubuntu-2004 ubuntu-2204 all: $(tags) .PHONY: all @@ -7,12 +6,12 @@ all: $(tags) print: @echo $(tags) -build-%: $(arch)/%.Dockerfile +build-%: buildx/%.Dockerfile @echo '******************' Build Nebula Third Party Docker For $*-$(arch) '********************' - @docker build --no-cache -t vesoft/third-party-build:$*-$(arch) -f $(arch)/$*.Dockerfile . + @docker build --no-cache -t vesoft/third-party-build:$* -f buildx/$*.Dockerfile . push-%: build-% - @echo '******************' Pushing image $*-$(arch) '********************' - @docker push vesoft/third-party-build:$*-$(arch) + @echo '******************' Pushing image $* '********************' + @docker push vesoft/third-party-build:$* %: push-% ; diff --git a/docker/buildx/centos-7.Dockerfile b/docker/buildx/centos-7.Dockerfile index 2186c89..50890cd 100644 --- a/docker/buildx/centos-7.Dockerfile +++ b/docker/buildx/centos-7.Dockerfile @@ -1,5 +1,6 @@ FROM centos:7 SHELL ["/bin/bash", "-c"] +ARG GOLANG_VERSION=1.21.6 RUN yum install -y epel-release && yum update -y \ && yum install -y make \ git \ @@ -41,6 +42,18 @@ RUN wget https://github.com/Kitware/CMake/releases/download/v3.20.0/cmake-3.20.0 && ./cmake-3.20.0-linux-$(uname -m).sh --skip-license --prefix=/usr/local \ && rm cmake-3.20.0-linux-$(uname -m).sh +# Install golang +RUN ARCH="$(uname -m)"; \ + case "${ARCH}" in \ + x86_64) GOARCH='amd64';; \ + aarch64) GOARCH='arm64';; \ + *) echo "Unsupported architecture: ${ARCH}" && exit 1;; \ + esac; \ + curl -L https://go.dev/dl/go${GOLANG_VERSION}.linux-${GOARCH}.tar.gz -o go.tar.gz && \ + tar -C /usr/local -xzf go.tar.gz && \ + rm go.tar.gz +ENV PATH="/usr/local/go/bin:${PATH}" + # Install ossutil RUN curl https://gosspublic.alicdn.com/ossutil/install.sh | bash diff --git a/docker/buildx/centos-8.Dockerfile b/docker/buildx/centos-8.Dockerfile index ffbbc8e..b254173 100644 --- a/docker/buildx/centos-8.Dockerfile +++ b/docker/buildx/centos-8.Dockerfile @@ -1,6 +1,6 @@ FROM centos:8 SHELL ["/bin/bash", "-c"] - +ARG GOLANG_VERSION=1.21.6 RUN cd /etc/yum.repos.d/ && \ sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* && \ sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* @@ -42,6 +42,18 @@ RUN wget https://github.com/Kitware/CMake/releases/download/v3.20.0/cmake-3.20.0 && ./cmake-3.20.0-linux-$(uname -m).sh --skip-license --prefix=/usr/local \ && rm cmake-3.20.0-linux-$(uname -m).sh +# Install golang +RUN ARCH="$(uname -m)"; \ + case "${ARCH}" in \ + x86_64) GOARCH='amd64';; \ + aarch64) GOARCH='arm64';; \ + *) echo "Unsupported architecture: ${ARCH}" && exit 1;; \ + esac; \ + curl -L https://go.dev/dl/go${GOLANG_VERSION}.linux-${GOARCH}.tar.gz -o go.tar.gz && \ + tar -C /usr/local -xzf go.tar.gz && \ + rm go.tar.gz +ENV PATH="/usr/local/go/bin:${PATH}" + # Install ossutil RUN curl https://gosspublic.alicdn.com/ossutil/install.sh | bash diff --git a/docker/buildx/rockylinux-8.Dockerfile b/docker/buildx/rockylinux-8.Dockerfile index 4f0e257..0df95b8 100644 --- a/docker/buildx/rockylinux-8.Dockerfile +++ b/docker/buildx/rockylinux-8.Dockerfile @@ -1,5 +1,6 @@ FROM rockylinux:8 SHELL ["/bin/bash", "-c"] +ARG GOLANG_VERSION=1.21.6 RUN yum install -y epel-release yum-utils && yum config-manager --set-enabled powertools && yum update -y \ && yum install -y make \ git \ @@ -37,6 +38,18 @@ RUN wget https://github.com/Kitware/CMake/releases/download/v3.20.0/cmake-3.20.0 && ./cmake-3.20.0-linux-$(uname -m).sh --skip-license --prefix=/usr/local \ && rm cmake-3.20.0-linux-$(uname -m).sh +# Install golang +RUN ARCH="$(uname -m)"; \ + case "${ARCH}" in \ + x86_64) GOARCH='amd64';; \ + aarch64) GOARCH='arm64';; \ + *) echo "Unsupported architecture: ${ARCH}" && exit 1;; \ + esac; \ + curl -L https://go.dev/dl/go${GOLANG_VERSION}.linux-${GOARCH}.tar.gz -o go.tar.gz && \ + tar -C /usr/local -xzf go.tar.gz && \ + rm go.tar.gz +ENV PATH="/usr/local/go/bin:${PATH}" + # Install ossutil RUN curl https://gosspublic.alicdn.com/ossutil/install.sh | bash diff --git a/docker/buildx/ubuntu-2004.Dockerfile b/docker/buildx/ubuntu-2004.Dockerfile index ce4632f..a6a73d0 100644 --- a/docker/buildx/ubuntu-2004.Dockerfile +++ b/docker/buildx/ubuntu-2004.Dockerfile @@ -1,5 +1,6 @@ FROM ubuntu:20.04 SHELL ["/bin/bash", "-c"] +ARG GOLANG_VERSION=1.21.6 RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone ARG DEBIAN_FRONTEND=noninteractive RUN apt update \ @@ -37,6 +38,18 @@ RUN wget https://github.com/Kitware/CMake/releases/download/v3.20.0/cmake-3.20.0 && ./cmake-3.20.0-linux-$(uname -m).sh --skip-license --prefix=/usr/local \ && rm cmake-3.20.0-linux-$(uname -m).sh +# Install golang +RUN ARCH="$(uname -m)"; \ + case "${ARCH}" in \ + x86_64) GOARCH='amd64';; \ + aarch64) GOARCH='arm64';; \ + *) echo "Unsupported architecture: ${ARCH}" && exit 1;; \ + esac; \ + curl -L https://go.dev/dl/go${GOLANG_VERSION}.linux-${GOARCH}.tar.gz -o go.tar.gz && \ + tar -C /usr/local -xzf go.tar.gz && \ + rm go.tar.gz +ENV PATH="/usr/local/go/bin:${PATH}" + # Install ossutil RUN curl https://gosspublic.alicdn.com/ossutil/install.sh | bash