-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docker build for running enigma devnet (#1)
* docker dev build
- Loading branch information
Showing
4 changed files
with
105 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Simple usage with a mounted data directory: | ||
# > docker build -t enigma . | ||
# > docker run -it -p 26657:26657 -p 26656:26656 -v ~/.enigmad:/root/.enigmad -v ~/.enigmacli:/root/.enigmacli enigma enigmad init | ||
# > docker run -it -p 26657:26657 -p 26656:26656 -v ~/.enigmad:/root/.enigmad -v ~/.enigmacli:/root/.enigmacli enigma enigmad start | ||
FROM rust:1.42-stretch AS build-env-rust | ||
|
||
# Set working directory for the build | ||
WORKDIR /go/src/github.com/enigmampc/enigmablockchain | ||
|
||
RUN rustup default nightly | ||
|
||
# Add source files | ||
COPY go-cosmwasm/ go-cosmwasm/ | ||
|
||
WORKDIR /go/src/github.com/enigmampc/enigmablockchain/go-cosmwasm | ||
RUN cargo build --release --features backtraces | ||
|
||
FROM golang:1.14-stretch AS build-env | ||
|
||
# Set up dependencies | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
make \ | ||
git && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Set working directory for the build | ||
WORKDIR /go/src/github.com/enigmampc/enigmablockchain | ||
|
||
# Add source files | ||
COPY . . | ||
|
||
COPY --from=build-env-rust /go/src/github.com/enigmampc/enigmablockchain/go-cosmwasm/target/release/libgo_cosmwasm.so go-cosmwasm/api | ||
|
||
RUN go mod tidy | ||
|
||
RUN make build_local_no_rust | ||
|
||
# Final image | ||
FROM ubuntu:18.04 | ||
|
||
# Install ca-certificates | ||
WORKDIR /root | ||
|
||
# Copy over binaries from the build-env | ||
COPY --from=build-env-rust /go/src/github.com/enigmampc/enigmablockchain/go-cosmwasm/target/release/libgo_cosmwasm.so /usr/lib/ | ||
COPY --from=build-env /go/src/github.com/enigmampc/enigmablockchain/enigmad /usr/bin/enigmad | ||
COPY --from=build-env /go/src/github.com/enigmampc/enigmablockchain/enigmacli /usr/bin/enigmacli | ||
|
||
COPY ./packaging_docker/devnet_init.sh . | ||
|
||
RUN chmod +x /usr/bin/enigmad | ||
RUN chmod +x /usr/bin/enigmacli | ||
|
||
# Run enigmad by default, omit entrypoint to ease using container with enigmacli | ||
ENTRYPOINT ["/bin/bash", "devnet_init.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
enigmacli config chain-id enigma-testnet # now we won't need to type --chain-id enigma-testnet every time | ||
enigmacli config output json | ||
enigmacli config indent true | ||
enigmacli config trust-node true # true if you trust the full-node you are connecting to, false otherwise | ||
|
||
enigmad init banana --chain-id enigma-testnet # banana==moniker==user-agent of this node | ||
perl -i -pe 's/"stake"/"uscrt"/g' ~/.enigmad/config/genesis.json # change the default staking denom from stake to uscrt | ||
|
||
enigmacli keys add a --keyring-backend test | ||
enigmacli keys add b --keyring-backend test | ||
|
||
enigmad add-genesis-account $(enigmacli keys show -a a --keyring-backend test) 1000000000000uscrt # 1 SCRT == 10^6 uSCRT | ||
enigmad add-genesis-account $(enigmacli keys show -a b --keyring-backend test) 2000000000000uscrt # 1 SCRT == 10^6 uSCRT | ||
|
||
enigmad validate-genesis # make sure genesis file is correct | ||
|
||
# `enigmad export` to send genesis.json to validators | ||
|
||
enigmad gentx --name a --amount 1000000uscrt --keyring-backend test # generate a genesis transaction - this makes a a validator on genesis which stakes 1000000uscrt (1 SCRT) | ||
|
||
enigmad collect-gentxs # input the genTx into the genesis file, so that the chain is aware of the validators | ||
|
||
enigmad validate-genesis # make sure genesis file is correct | ||
|
||
# `enigmad export` to send genesis.json to validators | ||
|
||
enigmad start --pruning nothing # starts a node |