feat(release): add docker images for sonrd and motr

This commit is contained in:
Prad Nukala 2024-10-01 22:02:14 -04:00
parent 5bc9ff07c0
commit cea6b77fdd
10 changed files with 346 additions and 3 deletions

View File

@ -1,3 +1,4 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema-pro.json
version: 2 version: 2
project_name: sonr project_name: sonr
@ -97,3 +98,47 @@ brews:
owner: onsonr owner: onsonr
name: homebrew-tap name: homebrew-tap
branch: master branch: master
# .goreleaser.yaml
dockers:
- # Sonr Binary
id: sonrd
goos: linux
goarch: amd64
ids:
- sonr
image_templates:
- "onsonr/sonrd:latest"
- "onsonr/sonrd:{{ .Tag }}"
- "onsonr/sonrd:v{{ .Major }}"
- "gcr.io/onsonr/sonrd:latest"
dockerfile: "./deploy/release/sonrd.Dockerfile"
build_flag_templates:
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title=sonrd"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- # Motr Binary
id: motr
goos: linux
goarch: amd64
ids:
- motr
image_templates:
- "onsonr/motr:latest"
- "onsonr/motr:{{ .Tag }}"
- "onsonr/motr:v{{ .Major }}"
dockerfile: "./deploy/release/motr.Dockerfile"
build_flag_templates:
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title=motr"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
announce:
telegram:
enabled: true
chat_id: -1002222617755
message_template: 'New Sonr Release {{.Tag}} is out{{ mdv2escape "!" }}'
parse_mode: HTML

View File

@ -0,0 +1,49 @@
root = "."
testdata_dir = "testdata"
tmp_dir = "tmp"
[build]
delay = 1000
cmd = "devbox run build:motr"
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
exclude_file = []
exclude_regex = ["_test.go"]
exclude_unchanged = true
follow_symlink = false
full_bin = "devbox run start"
include_dir = ["cmd/dwn", "cmd/motr", "internal", "models", "pkl"]
include_ext = ["go", "templ", "html", "pkl", "js", "mjs", "proto"]
include_file = [
"Dockerfile",
".goreleaser.yaml",
"go.mod",
"devbox.json",
".air.toml",
]
kill_delay = "10s"
log = "build-errors.log"
poll = false
poll_interval = 0
post_cmd = ["devbox run stop"]
pre_cmd = ["templ generate"]
rerun = false
rerun_delay = 1000
send_interrupt = true
stop_on_error = false
[color]
build = "yellow"
main = "magenta"
runner = "green"
watcher = "cyan"
[log]
main_only = true
time = true
[misc]
clean_on_exit = true
[screen]
clear_on_rebuild = true
keep_scroll = true

View File

@ -0,0 +1,49 @@
root = "."
testdata_dir = "testdata"
tmp_dir = "tmp"
[build]
delay = 1000
cmd = "devbox run build:motr"
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
exclude_file = []
exclude_regex = ["_test.go"]
exclude_unchanged = true
follow_symlink = false
full_bin = "devbox run start"
include_dir = ["cmd/dwn", "cmd/motr", "internal", "models", "pkl"]
include_ext = ["go", "templ", "html", "pkl", "js", "mjs", "proto"]
include_file = [
"Dockerfile",
".goreleaser.yaml",
"go.mod",
"devbox.json",
".air.toml",
]
kill_delay = "10s"
log = "build-errors.log"
poll = false
poll_interval = 0
post_cmd = ["devbox run stop"]
pre_cmd = ["templ generate"]
rerun = false
rerun_delay = 1000
send_interrupt = true
stop_on_error = false
[color]
build = "yellow"
main = "magenta"
runner = "green"
watcher = "cyan"
[log]
main_only = true
time = true
[misc]
clean_on_exit = true
[screen]
clear_on_rebuild = true
keep_scroll = true

View File

@ -0,0 +1,3 @@
FROM scratch
ENTRYPOINT ["/motr"]
COPY motr /

View File

@ -0,0 +1,3 @@
FROM scratch
ENTRYPOINT ["/sonrd"]
COPY sonrd /

View File

@ -0,0 +1,37 @@
# This file is used to create docker images using the heighliner binary.
# see: https://github.com/strangelove-ventures/heighliner
# Sonr Node - Identity
- name: sonr
github-organization: onsonr
github-repo: sonr
dockerfile: cosmos
build-target: make install
binaries:
- /go/bin/sonrd
build-env:
- LEDGER_ENABLED=false
- BUILD_TAGS=muslc
# Ethereum Node - Web3
- name: evmos
github-organization: tharsis
github-repo: evmos
dockerfile: cosmos
build-target: make install
binaries:
- /go/bin/evmosd
# Bitcoin Node - Gold
- name: nomic
github-organization: nomic-io
github-repo: nomic
dockerfile: cargo
build-target: |
TOOLCHAIN=$(cat rust-toolchain.toml | grep channel | awk '{print $3}' | tr -d '"')
rustup component add rust-src --toolchain ${TOOLCHAIN}-$(uname -m)-unknown-linux-gnu
cargo install --locked --path . -Zbuild-std
binaries:
- /build/nomic/target/${ARCH}-unknown-linux-gnu/release/nomic
platforms:
- linux/amd64

View File

@ -0,0 +1,92 @@
{
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.12.0/.schema/devbox.schema.json",
"packages": [
"go@1.22",
"air@latest",
"bun@latest",
"ipfs@latest",
"skate@latest",
"cloudflared@latest",
"process-compose@latest"
],
"env": {
"GOPATH": "$HOME/go",
"PATH": "$HOME/go/bin:$PATH",
"CHAIN_ID": "sonr-testnet-1",
"DENOM": "usnr",
"KEYRING": "test",
"MONIKER": "florence",
"BINARY": "sonrd",
"ACC0_NAME": "acc0",
"ACC1_NAME": "acc1",
"ACC0_ADDRESS": "idx1efd63aw40lxf3n4mhf7dzhjkr453axur9vjt6y",
"ACC1_ADDRESS": "idx1hj5fveer5cjtn4wd6wstzugjfdxzl0xpecp0nd",
"ACC0_MNEMONIC": "$(skate get ACC0_MNEMONIC)",
"ACC1_MNEMONIC": "$(skate get ACC1_MNEMONIC)",
"TUNNEL_TOKEN": "$(skate get CLOUDFLARE_TUNNEL_TOKEN)",
"TEMPL_EXPERIMENT": "rawgo"
},
"shell": {
"scripts": {
"dev": [
"air"
],
"build:docker": [
"make local-image"
],
"build:motr": [
"make nebula",
"make motr"
],
"build:nebula": [
"make nebula"
],
"build:sonrd": [
"make dwn",
"make build"
],
"build": [
"make dwn",
"make build",
"make motr"
],
"gen:proto": [
"make proto-gen"
],
"gen:pkl": [
"make pkl"
],
"gen:templ": [
"make templ"
],
"start:motr": [
"make templ",
"make motr",
"make start-motr"
],
"start:testnet": [
"make templ",
"make install",
"make sh-testnet"
],
"start": [
"process-compose up -d"
],
"stop": [
"process-compose down"
],
"test:e2e": [
"make templ",
"make test-e2e"
],
"test:unit": [
"make templ",
"make test-unit"
],
"test": [
"make templ",
"make test"
]
}
}
}

View File

@ -0,0 +1,30 @@
version: "3"
services:
sonr-node:
build:
context: .
dockerfile: Dockerfile
volumes:
- /home/prad/.scnr:/root/.sonr
ports:
- "26657:26657"
- "1317:1317"
- "9090:9090"
environment:
- CHAIN_ID=local-1
- MONIKER=localvalidator
- KEYRING=test
- KEY=user1
- KEY2=user2
- DENOM=usnr
- CLEAN=true
- BLOCK_TIME=5s
command: "start --pruning=nothing"
restart: always
networks:
- sonr-network
networks:
sonr-network:
name: sonr-network

View File

@ -0,0 +1,35 @@
version: "0.6"
processes:
ipfs:
namespace: testnet
command: "sh scripts/setup_ipfs.sh"
background: true
availability:
restart: on_failure
max_restarts: 0
sonr:
namespace: testnet
command: "devbox run start:testnet"
restart: on_failure
max_restarts: 1
depends:
- ipfs
motr:
namespace: testnet
command: "devbox run start:motr"
restart: on_failure
max_restarts: 1
depends:
- ipfs
- sonr
tunnel:
namespace: public
command: "cloudflared tunnel run --token $TUNNEL_TOKEN"
restart: on_failure
max_restarts: 1
depends:
- caddy

View File

@ -58,7 +58,7 @@ func Layout(title string, remote bool) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</title><!-- Sets the status bar style to transparent --><meta name=\"apple-mobile-web-app-capable\" content=\"yes\"><meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black-translucent\"></head><body class=\"flex items-center justify-center h-full bg-neutral-50 lg:p-24 md:16 p-4\"><main class=\"flex-row items-center justify-center mx-auto w-fit max-w-screen-sm gap-y-3\">") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</title><!-- Sets the status bar style to transparent --><meta name=\"apple-mobile-web-app-capable\" content=\"yes\"><meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black-translucent\"><link rel=\"icon\" type=\"image/png\" href=\"https://cdn.sonr.id/favicon.png\"></head><body class=\"flex items-center justify-center h-full bg-neutral-50 lg:p-24 md:16 p-4\"><main class=\"flex-row items-center justify-center mx-auto w-fit max-w-screen-sm gap-y-3\">")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -118,13 +118,13 @@ func LayoutNoBody(title string, remote bool) templ.Component {
var templ_7745c5c3_Var4 string var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(title) templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(title)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/blocks/layout.templ`, Line: 36, Col: 17} return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/blocks/layout.templ`, Line: 37, Col: 17}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</title><!-- Sets the status bar style to transparent --><meta name=\"apple-mobile-web-app-capable\" content=\"yes\"><meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black-translucent\"></head><main class=\"grow\"><body class=\"font-inter antialiased bg-white text-zinc-900 tracking-tight\"><div class=\"flex flex-col min-h-screen overflow-hidden supports-[overflow:clip]:overflow-clip\">") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</title><link rel=\"icon\" type=\"image/png\" href=\"https://cdn.sonr.id/favicon.png\"><!-- Sets the status bar style to transparent --><meta name=\"apple-mobile-web-app-capable\" content=\"yes\"><meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black-translucent\"></head><main class=\"grow\"><body class=\"font-inter antialiased bg-white text-zinc-900 tracking-tight\"><div class=\"flex flex-col min-h-screen overflow-hidden supports-[overflow:clip]:overflow-clip\">")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }