Tendermint rbuilder Docker 镜像提供了一个确定性构建环境,用于构建 Cosmos SDK 应用程序。它提供了一种方法,可以较为可靠地确认可执行文件确实是从 git 源码构建而来。同时,它还能确保使用相同且经过测试的依赖项,并将其静态构建到可执行文件中。

前置条件

请确保你的系统中已安装 Docker。 以下所有说明均已在 Ubuntu 18.04.2 LTS 和 docker 20.10.2 环境下测试。

构建

克隆 gaia:
git clone https://github.com/cosmos/gaia.git
检出你要构建的提交、分支或发布标签:
cd gaia/
git checkout v4.2.1
该构建系统支持并生成以下架构的二进制文件:
  • darwin/amd64
  • linux/amd64
  • linux/arm64
  • windows/amd64
运行以下命令,为所有受支持的架构启动构建:
make distclean build-reproducible
构建系统会在 artifacts 目录中生成二进制文件和确定性构建报告。 artifacts/build_report 文件包含构建产物列表及其对应的校验和,可用于验证构建的完整性。其内容示例如下:
App: gaiad
Version: v4.2.1
Commit: dbd8a6fb522c571debf958837f9113c56d418f6b
Files:
 29d219b0b120b3188bd7cd7249fc96b9  gaiad-v4.2.1-darwin-amd64
 80338d9f0e55ea8f6c93f2ec7d4e18d6  gaiad-v4.2.1-linux-amd64
 9bc77a512acca673ca1769ae67b4d6c7  gaiad-v4.2.1-linux-arm64
 c84387860f52178e2bffee08897564bb  gaiad-v4.2.1-windows-amd64.exe
 c25cca8ccceec06a6fabae90f671fab1  gaiad-v4.2.1.tar.gz
Checksums-Sha256:
 05e5b9064bac4e71f0162c4c3c3bff55def22ca016d34205a5520fef89fd2776  gaiad-v4.2.1-darwin-amd64
 ccda422cbda29c723aaf27653bcf0f6412e138eec33fba2b49de131f9ffbe2d2  gaiad-v4.2.1-linux-amd64
 95f89e8213cb758d12e1b0b631285938de822d04d2e25f399e99c0b798173cfd  gaiad-v4.2.1-linux-arm64
 7ef98f0041f1573f0a8601abad4a14b1c163f47481c7ba1954fd81ed423a6408  gaiad-v4.2.1-windows-amd64.exe
 422883ba43c96a6ea5ef9512d39321dd1356633c6a9505517b9c651788df4a7f  gaiad-v4.2.1.tar.gz

The Tendermint rbuilder Docker image provides a deterministic build environment that is used to build Cosmos SDK applications. It provides a way to be reasonably sure that the executables are really built from the git source. It also makes sure that the same, tested dependencies are used and statically built into the executable.

Prerequisites

Make sure you have Docker installed on your system. All the following instructions have been tested on Ubuntu 18.04.2 LTS with docker 20.10.2.

Build

Clone gaia:
git clone https://github.com/cosmos/gaia.git
Checkout the commit, branch, or release tag you want to build:
cd gaia/
git checkout v4.2.1
The buildsystem supports and produces binaries for the following architectures:
  • darwin/amd64
  • linux/amd64
  • linux/arm64
  • windows/amd64
Run the following command to launch a build for all supported architectures:
make distclean build-reproducible
The build system generates both the binaries and deterministic build report in the artifacts directory. The artifacts/build_report file contains the list of the build artifacts and their respective checksums, and can be used to verify build sanity. An example of its contents follows:
App: gaiad
Version: v4.2.1
Commit: dbd8a6fb522c571debf958837f9113c56d418f6b
Files:
 29d219b0b120b3188bd7cd7249fc96b9  gaiad-v4.2.1-darwin-amd64
 80338d9f0e55ea8f6c93f2ec7d4e18d6  gaiad-v4.2.1-linux-amd64
 9bc77a512acca673ca1769ae67b4d6c7  gaiad-v4.2.1-linux-arm64
 c84387860f52178e2bffee08897564bb  gaiad-v4.2.1-windows-amd64.exe
 c25cca8ccceec06a6fabae90f671fab1  gaiad-v4.2.1.tar.gz
Checksums-Sha256:
 05e5b9064bac4e71f0162c4c3c3bff55def22ca016d34205a5520fef89fd2776  gaiad-v4.2.1-darwin-amd64
 ccda422cbda29c723aaf27653bcf0f6412e138eec33fba2b49de131f9ffbe2d2  gaiad-v4.2.1-linux-amd64
 95f89e8213cb758d12e1b0b631285938de822d04d2e25f399e99c0b798173cfd  gaiad-v4.2.1-linux-arm64
 7ef98f0041f1573f0a8601abad4a14b1c163f47481c7ba1954fd81ed423a6408  gaiad-v4.2.1-windows-amd64.exe
 422883ba43c96a6ea5ef9512d39321dd1356633c6a9505517b9c651788df4a7f  gaiad-v4.2.1.tar.gz