From f18893ee0d290d79db632db21c71ccbc924f69fa Mon Sep 17 00:00:00 2001 From: gregnuj Date: Thu, 12 Oct 2023 17:34:58 -0500 Subject: [PATCH] update decentr, add crescent --- .github/workflows/crescent-build.yml | 65 ++++++++++++++++++++++++++++ .github/workflows/decentr-build.yml | 9 +++- alpine.Dockerfile | 14 +++--- builds/crescent.4.0.0.alpine.sh | 29 +++++++++++++ builds/decentr.1.5.7.alpine.sh | 44 +++++++++++++++++++ 5 files changed, 154 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/crescent-build.yml create mode 100755 builds/crescent.4.0.0.alpine.sh create mode 100755 builds/decentr.1.5.7.alpine.sh diff --git a/.github/workflows/crescent-build.yml b/.github/workflows/crescent-build.yml new file mode 100644 index 0000000..9017b4f --- /dev/null +++ b/.github/workflows/crescent-build.yml @@ -0,0 +1,65 @@ +name: crescent-build + +on: + pull_request: + branches: + - main + paths: + - 'bin/builder' + - 'arch.Dockerfile' + - 'alpine.Dockerfile' + - '.github/workflows/docker-build.yml' + - '.github/workflows/crescent-build.yml' + + push: + branches: + - main + paths: + - 'bin/builder' + - 'arch.Dockerfile' + - 'alpine.Dockerfile' + - '.github/workflows/docker-build.yml' + - '.github/workflows/crescent-build.yml' + +jobs: + crescent-build: + uses: ./.github/workflows/docker-build.yml + secrets: inherit + strategy: + fail-fast: false + matrix: + #platform: ["linux/amd64", "linux/arm64"] # need arm runners + platform: ["linux/amd64"] + distro: ["alpine"] + version: + - "1.5.7" + - "1.5.8" + - "1.6.0" + - "1.6.1" + - "1.6.2" + + include: + # Include Defaults (keep at top) + - name: "crescent" + binary: "crescentd" + build_command: "make install" + build_tags: "netgo" + chain_registry_name: "crescent" + go_version: "1.19" + repo: "crescent-network/crescent" + os: "linux" + arch: "amd64" + + with: + binary: ${{ matrix.binary }} + build_command: ${{ matrix.build_command }} + build_tags: ${{ matrix.build_tags }} + chain_registry_name: ${{ matrix.chain_registry_name }} + go_version: ${{ matrix.go_version }} + name: ${{ matrix.name }} + os: ${{ matrix.os }} + arch: ${{ matrix.arch }} + distro: ${{ matrix.distro }} + platform: ${{ matrix.platform }} + repo: ${{ matrix.repo }} + version: ${{ matrix.version }} diff --git a/.github/workflows/decentr-build.yml b/.github/workflows/decentr-build.yml index f880c93..19255ad 100644 --- a/.github/workflows/decentr-build.yml +++ b/.github/workflows/decentr-build.yml @@ -34,7 +34,6 @@ jobs: version: - "1.5.7" - "1.5.8" - - "1.5.9" - "1.6.0" - "1.6.1" - "1.6.2" @@ -44,15 +43,21 @@ jobs: - name: "decentr" binary: "decentrd" build_command: "make install" + build_tags: "netgo" chain_registry_name: "decentr" go_version: "1.19" repo: "Decentr-net/decentr" os: "linux" arch: "amd64" - + + - version: 1.5.7 + go_version: "1.16" + + with: binary: ${{ matrix.binary }} build_command: ${{ matrix.build_command }} + build_tags: ${{ matrix.build_tags }} chain_registry_name: ${{ matrix.chain_registry_name }} go_version: ${{ matrix.go_version }} name: ${{ matrix.name }} diff --git a/alpine.Dockerfile b/alpine.Dockerfile index 1b8d520..843841f 100644 --- a/alpine.Dockerfile +++ b/alpine.Dockerfile @@ -13,6 +13,7 @@ RUN set -eu &&\ bash \ bison \ curl \ + gcompat \ git COPY ./bin/install-mimalloc ./bin/install-wasmvm /usr/local/bin/ @@ -22,14 +23,10 @@ FROM base as builder ARG APP_NAME="terra" ARG BIN_NAME="${APP_NAME}d" -ARG BUILD_COMMAND="make install" -ARG BUILD_TAGS="netgo,ledger,muslc" ARG COSMOS_BUILD_OPTIONS="nostrip" ARG DENOM ARG GIT_TAG="v2.4.1" ARG GIT_REPO="terra-money/core" -#ARG LDFLAGS="-extldflags '-L/go/src/mimalloc/build -lmimalloc -Wl,-z,muldefs -static'" -ARG LDFLAGS='-w -s -linkmode external -extldflags "-Wl,-z,muldefs -static"' ARG MIMALLOC_VERSION ARG GO_VERSION @@ -63,7 +60,13 @@ RUN set -ux && \ [ -n "${WASMVM_VERSION}" ] && install-wasmvm "${WASMVM_VERSION}" || true # build the binary +ARG BUILD_COMMAND="make install" +ARG BUILD_TAGS="netgo,ledger,muslc" +ARG LDFLAGS='-w -s -linkmode external -extldflags "-Wl,-z,muldefs -static"' +#ARG LDFLAGS="-extldflags '-L/go/src/mimalloc/build -lmimalloc -Wl,-z,muldefs -static'" + ENV APP_NAME=${APP_NAME} \ + BUILD_COMMAND=${BUILD_COMMAND} \ BUILD_TAGS=${BUILD_TAGS} \ DENOM=${DENOM} \ LDFLAGS=${LDFLAGS} \ @@ -73,11 +76,12 @@ ENV APP_NAME=${APP_NAME} \ RUN --mount=type=cache,target=/root/.cache/go-build \ --mount=type=cache,target=/root/go/pkg/mod \ set -eux && \ + export CGO_ENABLED=0 && \ export COMMIT=GIT_COMMIT="$(git log -1 --format='%h')" && \ export VERSION=GIT_VERSION="$(git describe --tags --dirty --always)" && \ export DENOM=${DENOM:-"u$(echo ${APP_NAME} | head -c 4)"} && \ export GOWORK=off && \ - ${BUILD_COMMAND} + eval ${BUILD_COMMAND} # verify static binary RUN set -x && \ diff --git a/builds/crescent.4.0.0.alpine.sh b/builds/crescent.4.0.0.alpine.sh new file mode 100755 index 0000000..756ff44 --- /dev/null +++ b/builds/crescent.4.0.0.alpine.sh @@ -0,0 +1,29 @@ +#!/bin/sh -x + +BASEDIR=$(dirname "$0") +DOCKER_DIR="${BASEDIR}/.." +IMAGE="alpine" +NAME="crescent" +REPO="crescent-network/crescent" +TAG="4.0.0" +GO_VERSION="1.18" + +cd "${DOCKER_DIR}" +docker buildx build "." -f "${IMAGE}.Dockerfile" \ + --load \ + --progress plain \ + --tag "terraformlabs/${NAME}:${TAG}" \ + --platform "linux/amd64" \ + --build-arg "OS=linux" \ + --build-arg "ARCH=amd64" \ + --build-arg "APP_NAME=${NAME}" \ + --build-arg "BIN_NAME=${NAME}d" \ + --build-arg "BUILD_COMMAND=make install" \ + --build-arg "BUILD_TAGS=netgo ledger muslc" \ + --build-arg "COSMOS_BUILD_OPTIONS=" \ + --build-arg "GIT_TAG=v${TAG}" \ + --build-arg "GIT_REPO=${REPO}" \ + --build-arg "GO_VERSION=${GO_VERSION}" \ + --build-arg "MIMALLOC_VERSION=" \ + --build-arg "LDFLAGS=-w -s -linkmode=external -extldflags \"-Wl,-z,muldefs -static\"" \ + $@ diff --git a/builds/decentr.1.5.7.alpine.sh b/builds/decentr.1.5.7.alpine.sh new file mode 100755 index 0000000..04f9dca --- /dev/null +++ b/builds/decentr.1.5.7.alpine.sh @@ -0,0 +1,44 @@ +#!/bin/sh -x + +BASEDIR=$(dirname "$0") +DOCKER_DIR="${BASEDIR}/.." +IMAGE="alpine" +NAME="decentr" +REPO="Decentr-net/decentr" +TAG="1.5.7" +GO_VERSION="1.16" + +# BUILD_COMMAND=$(cat <<-'EOT' +# go install \ +# -mod=readonly \ +# -tags "netgo ledger muslc" \ +# -ldflags '\ +# -X github.com/cosmos/cosmos-sdk/version.Name=decentr \ +# -X github.com/cosmos/cosmos-sdk/version.AppName=decentrd \ +# -X github.com/cosmos/cosmos-sdk/version.Version=${VERSION} \ +# -X github.com/cosmos/cosmos-sdk/version.Commit=${COMMIT} \ +# -w -s -linkmode=external -extldflags \"-Wl,-z,muldefs -static -lgcompat\" \ +# ' \ +# -trimpath \ +# ./cmd/decentrd +# EOT +# ) + +cd "${DOCKER_DIR}" +docker buildx build "." -f "${IMAGE}.Dockerfile" \ + --load \ + --progress plain \ + --tag "terraformlabs/${NAME}:${TAG}" \ + --platform "linux/amd64" \ + --build-arg "OS=linux" \ + --build-arg "ARCH=amd64" \ + --build-arg "APP_NAME=${NAME}" \ + --build-arg "BIN_NAME=${NAME}d" \ + --build-arg "BUILD_TAGS=netgo ledger muslc" \ + --build-arg "COSMOS_BUILD_OPTIONS=" \ + --build-arg "GIT_TAG=v${TAG}" \ + --build-arg "GIT_REPO=${REPO}" \ + --build-arg "GO_VERSION=${GO_VERSION}" \ + --build-arg "MIMALLOC_VERSION=" \ + --build-arg "LDFLAGS=-w -s -linkmode=external -extldflags \"-Wl,-z,muldefs -static\"" \ + $@