Skip to content

Commit

Permalink
add dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
smk762 committed Mar 15, 2024
1 parent d064129 commit 3489ce8
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 29 deletions.
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

FROM golang:1.20-alpine AS builder
RUN apk update && apk add --no-cache make git gcc libc-dev linux-headers python3-dev
WORKDIR /nucleus
COPY . /nucleus
RUN make clean
RUN go mod tidy && go mod download
RUN make build
RUN python3 ./init.py -b /nucleus/build/nucleusd -c /root/.nucleus --overwrite

FROM alpine:latest
WORKDIR /nucleus
COPY --from=builder /nucleus/build/nucleusd /usr/bin/nucleusd
COPY --from=builder /root/.nucleus /root/.nucleus
# COPY --from=builder /nucleus/nucleus_conf.yaml /root/.nucleus/config.yaml

CMD ["nucleusd", "start"]
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/cosmos/cosmos-sdk/server/api"
"github.com/cosmos/cosmos-sdk/server/config"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
"github.com/cosmos/cosmos-sdk/simapp"
"cosmos/cosmos-sdk/simapp"

Check failure on line 20 in app/app.go

View workflow job for this annotation

GitHub Actions / benchmarks

package cosmos/cosmos-sdk/simapp is not in GOROOT (/opt/hostedtoolcache/go/1.19.4/x64/src/cosmos/cosmos-sdk/simapp)

Check failure on line 20 in app/app.go

View workflow job for this annotation

GitHub Actions / build-and-install (amd64)

package cosmos/cosmos-sdk/simapp is not in GOROOT (/opt/hostedtoolcache/go/1.19.4/x64/src/cosmos/cosmos-sdk/simapp)

Check failure on line 20 in app/app.go

View workflow job for this annotation

GitHub Actions / tests

package cosmos/cosmos-sdk/simapp is not in GOROOT (/opt/hostedtoolcache/go/1.19.4/x64/src/cosmos/cosmos-sdk/simapp)

Check failure on line 20 in app/app.go

View workflow job for this annotation

GitHub Actions / build-and-install (arm)

package cosmos/cosmos-sdk/simapp is not in GOROOT (/opt/hostedtoolcache/go/1.19.4/x64/src/cosmos/cosmos-sdk/simapp)

Check failure on line 20 in app/app.go

View workflow job for this annotation

GitHub Actions / build-and-install (arm64)

package cosmos/cosmos-sdk/simapp is not in GOROOT (/opt/hostedtoolcache/go/1.19.4/x64/src/cosmos/cosmos-sdk/simapp)
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
Expand Down
2 changes: 1 addition & 1 deletion app/simulation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"
"time"

"github.com/cosmos/cosmos-sdk/simapp"
"cosmos/cosmos-sdk/simapp"
simulationtypes "github.com/cosmos/cosmos-sdk/types/simulation"
"github.com/cosmos/cosmos-sdk/x/simulation"
"github.com/stretchr/testify/require"
Expand Down
46 changes: 29 additions & 17 deletions init.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,7 @@
import pathlib
import shutil
import subprocess

NUCLEUS_BIN = "nucleusd"
NUCLEUS_SYSROOT = str(pathlib.Path.home().joinpath(".nucleus"))

CHAIN_ID = "nucleus-1"
PAIR1 = "alice"
PAIR2 = "bob"
MONIKER = "nimda"

DEV_ADDRESS = "nuc1llp0f6qxemgh4g4m5ewk0ew0hxj76avukahzwu"

PAIR1_MNEMONIC = "explain chalk inch snake snack fade news bus horn grant stereo surface panic sister absurd lens speed never inhale element junk senior bubble return"
# PAIR1_ADDRESS="nuc15d4sf4z6y0vk9dnum8yzkvr9c3wq4q89hzvgjk"

PAIR2_MNEMONIC = "young twist cube soldier sorry false dry actor assault roast mosquito brain fix seat wrong sauce impact smoke expect donkey hard decline polar dinosaur"
# PAIR2_ADDRESS="nuc1yfygf0zr5s69ces9r0h72hqv23nkqz9nej732n"
import argparse


def check_if_already_initialized():
Expand Down Expand Up @@ -147,7 +132,34 @@ def add_htlc_genesis_config(data):
data["app_state"]["htlc"] = htlc_genesis_config

if __name__ == "__main__":
check_if_already_initialized()

CHAIN_ID = "nucleus-1"
PAIR1 = "alice"
PAIR2 = "bob"
MONIKER = "nimda"

DEV_ADDRESS = "nuc1llp0f6qxemgh4g4m5ewk0ew0hxj76avukahzwu"

PAIR1_MNEMONIC = "explain chalk inch snake snack fade news bus horn grant stereo surface panic sister absurd lens speed never inhale element junk senior bubble return"
# PAIR1_ADDRESS="nuc15d4sf4z6y0vk9dnum8yzkvr9c3wq4q89hzvgjk"

PAIR2_MNEMONIC = "young twist cube soldier sorry false dry actor assault roast mosquito brain fix seat wrong sauce impact smoke expect donkey hard decline polar dinosaur"
# PAIR2_ADDRESS="nuc1yfygf0zr5s69ces9r0h72hqv23nkqz9nej732n"

parser = argparse.ArgumentParser(description="Download API module file for specified version and platform.")
# Optional arguments
parser.add_argument("-b", "--bin", help="path to nucleusd binary", default="nucleusd")
parser.add_argument("-c", "--config", help="path to nucleusd configs", default=str(pathlib.Path.home().joinpath(".nucleus")))
parser.add_argument("--overwrite", help="overwrites existing configs", action="store_true")
args = parser.parse_args()

NUCLEUS_BIN = args.bin
NUCLEUS_SYSROOT = args.config

# TODO: Add argparse support for custom chain id, moniker, mnemonic, dev address

if not args.overwrite:
check_if_already_initialized()
init_genesis()
update_app_toml()
update_rpc_host()
Expand Down
3 changes: 2 additions & 1 deletion testutil/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ import (

"github.com/komodoplatform/nucleus/app"

"cosmos/cosmos-sdk/simapp"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/crypto/hd"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
pruningtypes "github.com/cosmos/cosmos-sdk/pruning/types"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/cosmos/cosmos-sdk/testutil/network"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
Expand Down
17 changes: 9 additions & 8 deletions x/htlc/simulation/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import (

tmbytes "github.com/tendermint/tendermint/libs/bytes"

"cosmos/cosmos-sdk/simapp/helpers"

Check failure on line 10 in x/htlc/simulation/operation.go

View workflow job for this annotation

GitHub Actions / benchmarks

package cosmos/cosmos-sdk/simapp/helpers is not in GOROOT (/opt/hostedtoolcache/go/1.19.4/x64/src/cosmos/cosmos-sdk/simapp/helpers)

Check failure on line 10 in x/htlc/simulation/operation.go

View workflow job for this annotation

GitHub Actions / build-and-install (amd64)

package cosmos/cosmos-sdk/simapp/helpers is not in GOROOT (/opt/hostedtoolcache/go/1.19.4/x64/src/cosmos/cosmos-sdk/simapp/helpers)

Check failure on line 10 in x/htlc/simulation/operation.go

View workflow job for this annotation

GitHub Actions / tests

package cosmos/cosmos-sdk/simapp/helpers is not in GOROOT (/opt/hostedtoolcache/go/1.19.4/x64/src/cosmos/cosmos-sdk/simapp/helpers)

Check failure on line 10 in x/htlc/simulation/operation.go

View workflow job for this annotation

GitHub Actions / build-and-install (arm)

package cosmos/cosmos-sdk/simapp/helpers is not in GOROOT (/opt/hostedtoolcache/go/1.19.4/x64/src/cosmos/cosmos-sdk/simapp/helpers)

Check failure on line 10 in x/htlc/simulation/operation.go

View workflow job for this annotation

GitHub Actions / build-and-install (arm64)

package cosmos/cosmos-sdk/simapp/helpers is not in GOROOT (/opt/hostedtoolcache/go/1.19.4/x64/src/cosmos/cosmos-sdk/simapp/helpers)
simappparams "cosmos/cosmos-sdk/simapp/params"

Check failure on line 11 in x/htlc/simulation/operation.go

View workflow job for this annotation

GitHub Actions / benchmarks

package cosmos/cosmos-sdk/simapp/params is not in GOROOT (/opt/hostedtoolcache/go/1.19.4/x64/src/cosmos/cosmos-sdk/simapp/params)

Check failure on line 11 in x/htlc/simulation/operation.go

View workflow job for this annotation

GitHub Actions / build-and-install (amd64)

package cosmos/cosmos-sdk/simapp/params is not in GOROOT (/opt/hostedtoolcache/go/1.19.4/x64/src/cosmos/cosmos-sdk/simapp/params)

Check failure on line 11 in x/htlc/simulation/operation.go

View workflow job for this annotation

GitHub Actions / tests

package cosmos/cosmos-sdk/simapp/params is not in GOROOT (/opt/hostedtoolcache/go/1.19.4/x64/src/cosmos/cosmos-sdk/simapp/params)

Check failure on line 11 in x/htlc/simulation/operation.go

View workflow job for this annotation

GitHub Actions / build-and-install (arm)

package cosmos/cosmos-sdk/simapp/params is not in GOROOT (/opt/hostedtoolcache/go/1.19.4/x64/src/cosmos/cosmos-sdk/simapp/params)

Check failure on line 11 in x/htlc/simulation/operation.go

View workflow job for this annotation

GitHub Actions / build-and-install (arm64)

package cosmos/cosmos-sdk/simapp/params is not in GOROOT (/opt/hostedtoolcache/go/1.19.4/x64/src/cosmos/cosmos-sdk/simapp/params)

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/simapp/helpers"
simappparams "github.com/cosmos/cosmos-sdk/simapp/params"
sdk "github.com/cosmos/cosmos-sdk/types"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
"github.com/cosmos/cosmos-sdk/x/simulation"
Expand Down Expand Up @@ -84,12 +85,12 @@ func SimulateMsgCreateHtlc(k keeper.Keeper, ak types.AccountKeeper, bk types.Ban
maxLock := int(assert.MaxBlockLock)
timeLock := uint64(simtypes.RandIntBetween(r, minLock, maxLock))
msg := &types.MsgCreateHTLC{
Sender: sender.Address.String(),
To: to.Address.String(),
Amount: amount,
HashLock: hashLock,
Timestamp: timestamp,
TimeLock: timeLock,
Sender: sender.Address.String(),
To: to.Address.String(),
Amount: amount,
HashLock: hashLock,
Timestamp: timestamp,
TimeLock: timeLock,
}

fees, err := simtypes.RandomFees(r, ctx, balance)
Expand Down
3 changes: 2 additions & 1 deletion x/nucleus/module_simulation.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (
nucleussimulation "github.com/komodoplatform/nucleus/x/nucleus/simulation"
"github.com/komodoplatform/nucleus/x/nucleus/types"

simappparams "cosmos/cosmos-sdk/simapp/params"

"github.com/cosmos/cosmos-sdk/baseapp"
simappparams "github.com/cosmos/cosmos-sdk/simapp/params"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
Expand Down

0 comments on commit 3489ce8

Please sign in to comment.