|
| 1 | +# ============================================================================ |
| 2 | +# Dockermint Recipe - Cosmos Hub (Gaiad) |
| 3 | +# ============================================================================ |
| 4 | +# Dockermint is a CD pipeline for building standardized Docker images |
| 5 | +# of Cosmos SDK blockchain nodes. |
| 6 | +# |
| 7 | +# Variables syntax: |
| 8 | +# {{UPPERCASE}} # Defined by Dockermint from the host |
| 9 | +# {{lowercase}} # Defined dynamically during compilation |
| 10 | +# shell = "" # Shell execution with output capture |
| 11 | +# ============================================================================ |
| 12 | + |
| 13 | +[meta] |
| 14 | +schema_version = 1 |
| 15 | +min_dockermint_version = "0.1.0" |
| 16 | + |
| 17 | +[header] |
| 18 | +name = "Cosmos" |
| 19 | +repo = "https://github.com/cosmos/gaia" |
| 20 | +type = "golang" |
| 21 | +binary_name = "gaiad" |
| 22 | +include_patterns = "" |
| 23 | +exclude_patterns = "" |
| 24 | + |
| 25 | +# ============================================================================ |
| 26 | +# Available and default flavours |
| 27 | +# ============================================================================ |
| 28 | + |
| 29 | +[flavours.available] |
| 30 | +architecture = ["x86_64", "aarch64"] |
| 31 | +db_backend = ["goleveldb", "pebbledb"] |
| 32 | +binary_type = ["dynamic", "static"] |
| 33 | +running_env = ["alpine3.23", "bookworm", "distroless"] |
| 34 | +running_user = ["root", "custom", "dockermint"] |
| 35 | +build_tags = ["netgo", "ledger", "muslc"] |
| 36 | + |
| 37 | +[flavours.default] |
| 38 | +architecture = "{{HOST_ARCH}}" |
| 39 | +db_backend = "goleveldb" |
| 40 | +binary_type = "static" |
| 41 | +running_env = "alpine3.23" |
| 42 | +running_user = "root" |
| 43 | +build_tags = ["netgo", "muslc"] |
| 44 | + |
| 45 | +# ============================================================================ |
| 46 | +# Scrapper |
| 47 | +# ============================================================================ |
| 48 | + |
| 49 | +[scrapper] |
| 50 | +image = "golang:1.23-alpine3.21" |
| 51 | +install = "apk add --no-cache git" |
| 52 | +env = ["{{GH_USER}}", "{{GH_PAT}}"] |
| 53 | +method = "try-authenticated-clone" |
| 54 | +directory = "{{repository_path}}" |
| 55 | + |
| 56 | +# ============================================================================ |
| 57 | +# Build variables |
| 58 | +# ============================================================================ |
| 59 | + |
| 60 | +[variables] |
| 61 | +repo_commit = { shell = "git log -1 --format='%H'" } |
| 62 | +repo_version = { shell = "git describe --exact-match 2>/dev/null || echo \"$(git rev-parse --abbrev-ref HEAD)-$(git log -1 --format='%H')\"" } |
| 63 | +golang_version = { shell = "grep -E '^(toolchain|go) ' go.mod | head -1 | sed 's/^toolchain go//;s/^go //'" } |
| 64 | +wasmvm_version = { shell = "go list -m github.com/CosmWasm/wasmvm/v2 2>/dev/null | sed 's:.* ::'" } |
| 65 | +cometbft_version = { shell = "go list -m github.com/cometbft/cometbft | sed 's:.* ::'" } |
| 66 | +cometbft_db_version = { shell = "go list -m github.com/cometbft/cometbft-db 2>/dev/null | sed 's:.* ::'" } |
| 67 | +cosmos_db_version = { shell = "go list -m github.com/cosmos/cosmos-db 2>/dev/null | sed 's:.* ::'" } |
| 68 | + |
| 69 | +# ============================================================================ |
| 70 | +# Builder |
| 71 | +# ============================================================================ |
| 72 | + |
| 73 | +[builder.install] |
| 74 | +alpine = "apk add --no-cache alpine-sdk linux-headers" |
| 75 | +ubuntu = "apt-get update && apt-get install -y --no-install-recommends make gcc build-essential linux-headers-generic" |
| 76 | + |
| 77 | +# ============================================================================ |
| 78 | +# Conditional pre-build steps |
| 79 | +# ============================================================================ |
| 80 | + |
| 81 | +[[pre_build]] |
| 82 | +condition = "static" |
| 83 | +instruction = "ADD" |
| 84 | +source = "https://github.com/CosmWasm/wasmvm/releases/download/{{wasmvm_version}}/libwasmvm_muslc.{{HOST_ARCH}}.a" |
| 85 | +dest = "/lib/libwasmvm_muslc.{{HOST_ARCH}}.a" |
| 86 | + |
| 87 | +# ============================================================================ |
| 88 | +# Build environment variables |
| 89 | +# ============================================================================ |
| 90 | + |
| 91 | +[build.env] |
| 92 | +CGO_ENABLED = "1" |
| 93 | + |
| 94 | +# ============================================================================ |
| 95 | +# Go linker configuration |
| 96 | +# ============================================================================ |
| 97 | + |
| 98 | +[build.linker.flags] |
| 99 | +dynamic = "-w -s -extldflags '-z noexecstack'" |
| 100 | +static = "-linkmode=external -w -s -extldflags '-Wl,-z,muldefs -static -z noexecstack'" |
| 101 | + |
| 102 | +[build.linker.variables] |
| 103 | +"github.com/cosmos/cosmos-sdk/version.Name" = "gaia" |
| 104 | +"github.com/cosmos/cosmos-sdk/version.AppName" = "{{binary_name}}" |
| 105 | +"github.com/cosmos/cosmos-sdk/version.Version" = "{{repo_version}}" |
| 106 | +"github.com/cosmos/cosmos-sdk/version.Commit" = "{{repo_commit}}" |
| 107 | +"github.com/cosmos/cosmos-sdk/version.BuildTags" = "{{BUILD_TAGS_COMMA_SEP}}" |
| 108 | +"github.com/cometbft/cometbft/version.TMCoreSemVer" = "{{cometbft_version}}" |
| 109 | +"github.com/cosmos/cosmos-sdk/types.DBBackend" = "{{db_backend}}" |
| 110 | + |
| 111 | +# ============================================================================ |
| 112 | +# Builder other parameters |
| 113 | +# ============================================================================ |
| 114 | + |
| 115 | +[build.path] |
| 116 | +path = "{{repository_path}}/cmd/gaiad" |
| 117 | + |
| 118 | +# ============================================================================ |
| 119 | +# Dockermint user configuration (when running_user == "dockermint") |
| 120 | +# ============================================================================ |
| 121 | + |
| 122 | +[user.dockermint] |
| 123 | +username = "dockermint" |
| 124 | +uid = 10000 |
| 125 | +gid = 10000 |
| 126 | + |
| 127 | +# ============================================================================ |
| 128 | +# Files to copy from builder to runner |
| 129 | +# ============================================================================ |
| 130 | + |
| 131 | +[copy] |
| 132 | +"/go/bin/gaiad" = { dest = "/usr/bin/{{binary_name}}", type = "entrypoint" } |
| 133 | + |
| 134 | +[copy.dynamic] |
| 135 | +"/go/pkg/mod/github.com/!cosm!wasm/wasmvm/v2@{{wasmvm_version}}/internal/api/libwasmvm.{{HOST_ARCH}}.so" = { dest = "/lib/libwasmvm.{{HOST_ARCH}}.so", type = "dyn-library" } |
| 136 | + |
| 137 | +# ============================================================================ |
| 138 | +# Default exposed ports |
| 139 | +# ============================================================================ |
| 140 | + |
| 141 | +[expose] |
| 142 | +ports = [ |
| 143 | + { port = 26656, description = "P2P" }, |
| 144 | + { port = 26657, description = "RPC" }, |
| 145 | + { port = 26660, description = "Prometheus metrics" }, |
| 146 | + { port = 1317, description = "REST API" }, |
| 147 | + { port = 9090, description = "gRPC" }, |
| 148 | + { port = 9091, description = "gRPC-Web" }, |
| 149 | +] |
| 150 | + |
| 151 | +# ============================================================================ |
| 152 | +# OCI Labels |
| 153 | +# ============================================================================ |
| 154 | + |
| 155 | +[labels] |
| 156 | +"org.opencontainers.image.created" = "{{CREATION_TIMESTAMP}}" |
| 157 | +"org.opencontainers.image.authors" = "Dockermint CD" |
| 158 | +"org.opencontainers.image.url" = "https://github.com/cosmos/gaia" |
| 159 | +"org.opencontainers.image.documentation" = "https://docs.cosmos.network/hub" |
| 160 | +"org.opencontainers.image.source" = "https://github.com/cosmos/gaia" |
| 161 | +"org.opencontainers.image.version" = "{{repo_version}}" |
| 162 | +"org.opencontainers.image.revision" = "{{repo_commit}}" |
| 163 | +"org.opencontainers.image.vendor" = "the Gaia authors" |
| 164 | +"org.opencontainers.image.licenses" = "Apache-2.0" |
| 165 | +"org.opencontainers.image.title" = "Gaiad" |
| 166 | +"org.opencontainers.image.description" = "Cosmos Hub Node" |
| 167 | + |
| 168 | +# ============================================================================ |
| 169 | +# Docker image tag |
| 170 | +# ============================================================================ |
| 171 | + |
| 172 | +[image] |
| 173 | +tag = "cosmos-gaiad-{{db_backend}}:{{SEMVER_TAG}}-{{running_env}}" |
0 commit comments