From 1fef037e0773d95dde3c07f10de5376322cbb6ca Mon Sep 17 00:00:00 2001 From: George <58841610+Shinji-IkariG@users.noreply.github.com> Date: Thu, 11 Jan 2024 14:50:38 +0800 Subject: [PATCH] Add golang (#118) * Update pull_request.yml * Update pull_request.yml * add golang * add libstdc++ * Update build.yml --- .github/workflows/build.yml | 2 +- README.md | 3 ++- build/Makefile | 7 +++---- docker/Makefile | 11 +++++------ docker/buildx/centos-7.Dockerfile | 13 +++++++++++++ docker/buildx/centos-8.Dockerfile | 15 ++++++++++++++- docker/buildx/rockylinux-8.Dockerfile | 13 +++++++++++++ docker/buildx/ubuntu-2004.Dockerfile | 13 +++++++++++++ 8 files changed, 64 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e45ff74..f805cd2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,7 @@ on: - 'master' concurrency: - group: ${{ github.head_ref }} + group: ${{ github.ref }} cancel-in-progress: true defaults: 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..e998d59 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-* @@ -33,6 +33,7 @@ RUN yum install -y epel-release yum-utils && yum config-manager --set-enabled p flex \ gperf \ gettext \ + libstdc++-devel \ && yum --enablerepo=powertools install -y ninja-build \ && yum clean all && rm -rf /var/cache/yum @@ -42,6 +43,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