-
Notifications
You must be signed in to change notification settings - Fork 122
feat(ethexe): add Dockerfile for ethereum & ethexe node #5219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
StackOverflowExcept1on
wants to merge
1
commit into
master
Choose a base branch
from
av/ethexe-docker
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,24 @@ | ||
| FROM ubuntu:24.04 AS builder | ||
| WORKDIR / | ||
| ENV PATH="${PATH}:/root/.cargo/bin" | ||
| RUN apt update && \ | ||
| apt install --no-install-recommends --yes \ | ||
| build-essential \ | ||
| ca-certificates \ | ||
| clang \ | ||
| curl \ | ||
| git \ | ||
| protobuf-compiler && \ | ||
| rm -rf /var/lib/apt/lists/* && \ | ||
| curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain none -y && \ | ||
| git clone --depth 1 --recurse-submodules https://github.com/gear-tech/gear.git && \ | ||
| cd gear && \ | ||
| cargo clean && \ | ||
| cargo build --package ethexe-cli --release && \ | ||
| cp ./target/release/ethexe ethexe-bin && \ | ||
| rm -rf /root/.cargo/registry /root/.cargo/git target | ||
|
|
||
| FROM ubuntu:24.04 | ||
| WORKDIR /vara-eth-node | ||
| COPY --from=builder /gear/ethexe-bin /usr/local/bin/ethexe | ||
| CMD ["ethexe", "run"] | ||
This file contains hidden or 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,15 @@ | ||
| # Compiler files | ||
| cache/ | ||
| out/ | ||
|
|
||
| # Ignores development broadcast logs | ||
| broadcast/ | ||
|
|
||
| # Docs | ||
| docs/ | ||
|
|
||
| # Dotenv file | ||
| .env | ||
|
|
||
| # npm | ||
| package-lock.json |
This file contains hidden or 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 hidden or 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,75 @@ | ||
| FROM ubuntu:24.04 AS builder | ||
| # required | ||
| ARG PRIVATE_KEY | ||
| ARG ROUTER_AGGREGATED_PUBLIC_KEY_X | ||
| ARG ROUTER_AGGREGATED_PUBLIC_KEY_Y | ||
| ARG ROUTER_VERIFIABLE_SECRET_SHARING_COMMITMENT | ||
| ARG ROUTER_VALIDATORS_LIST | ||
| # optional | ||
| ARG SENDER_ADDRESS | ||
| ARG IS_POA="true" | ||
| # constants | ||
| ARG RPC_URL="http://127.0.0.1:8545" | ||
| ARG PREDEFINED_PRIVATE_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" | ||
| WORKDIR /contracts | ||
| COPY . . | ||
| ENV PATH="${PATH}:/root/.foundry/bin" | ||
| ENV NVM_DIR="/root/.nvm" | ||
| RUN test -n "${PRIVATE_KEY}" || { echo "PRIVATE_KEY is required" >&2; exit 1; } && \ | ||
| test -n "${ROUTER_AGGREGATED_PUBLIC_KEY_X}" || { echo "ROUTER_AGGREGATED_PUBLIC_KEY_X is required" >&2; exit 1; } && \ | ||
| test -n "${ROUTER_AGGREGATED_PUBLIC_KEY_Y}" || { echo "ROUTER_AGGREGATED_PUBLIC_KEY_Y is required" >&2; exit 1; } && \ | ||
| test -n "${ROUTER_VERIFIABLE_SECRET_SHARING_COMMITMENT}" || { echo "ROUTER_VERIFIABLE_SECRET_SHARING_COMMITMENT is required" >&2; exit 1; } && \ | ||
| test -n "${ROUTER_VALIDATORS_LIST}" || { echo "ROUTER_VALIDATORS_LIST is required" >&2; exit 1; } && \ | ||
| apt update && \ | ||
| apt install --no-install-recommends --yes \ | ||
| ca-certificates \ | ||
| curl \ | ||
| git \ | ||
| jq && \ | ||
| rm -rf /var/lib/apt/lists/* && \ | ||
| curl -L https://foundry.paradigm.xyz | bash && \ | ||
| foundryup && \ | ||
| forge --version && \ | ||
| forge compiler resolve && \ | ||
| curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.4/install.sh | bash && \ | ||
| \. "$NVM_DIR/nvm.sh" && \ | ||
| nvm install --lts && \ | ||
| npm install -g npm@latest && \ | ||
| node --version && \ | ||
| npm --version && \ | ||
| npx @openzeppelin/upgrades-core@^1.37.0 && \ | ||
| ( \ | ||
| anvil --dump-state ./chain-state.json & \ | ||
| ANVIL_PID=$! && \ | ||
| cast block-number --rpc-url $RPC_URL && \ | ||
| # 100 ETH in wei for each address | ||
| cast send \ | ||
| --rpc-url $RPC_URL \ | ||
| --value 100000000000000000000 \ | ||
| --private-key $PREDEFINED_PRIVATE_KEY \ | ||
| $(cast wallet addr --private-key $PRIVATE_KEY) && \ | ||
| test -n "$SENDER_ADDRESS" && cast send \ | ||
| --rpc-url $RPC_URL \ | ||
| --value 100000000000000000000 \ | ||
| --private-key $PREDEFINED_PRIVATE_KEY \ | ||
| $SENDER_ADDRESS || true && \ | ||
| echo "$ROUTER_VALIDATORS_LIST" | tr ',' '\n' | \ | ||
| while read VALIDATOR_ADDRESS; do \ | ||
| cast send \ | ||
| --rpc-url $RPC_URL \ | ||
| --value 100000000000000000000 \ | ||
| --private-key $PREDEFINED_PRIVATE_KEY \ | ||
| "$VALIDATOR_ADDRESS" || true; \ | ||
| done && \ | ||
| ./deploy.sh $RPC_URL && \ | ||
| sleep 5 && \ | ||
| kill -2 $ANVIL_PID && \ | ||
| wait $ANVIL_PID \ | ||
| ) | ||
StackOverflowExcept1on marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| FROM ubuntu:24.04 | ||
| WORKDIR /vara-eth-ethereum-node | ||
| COPY --from=builder /contracts/chain-state.json . | ||
| COPY --from=builder /root/.foundry/bin/anvil /usr/local/bin/anvil | ||
| EXPOSE 8545 | ||
| CMD ["anvil", "--block-time", "12", "--load-state", "./chain-state.json", "--host", "0.0.0.0"] | ||
This file contains hidden or 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
File renamed without changes.
This file contains hidden or 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,16 @@ | ||
| services: | ||
| vara-eth-ethereum-node: | ||
| container_name: vara-eth-ethereum-node | ||
| image: gear-tech/vara-eth-ethereum-node:latest | ||
| build: | ||
| context: ./contracts | ||
| dockerfile: Dockerfile | ||
| args: | ||
| PRIVATE_KEY: ${PRIVATE_KEY} | ||
| ROUTER_AGGREGATED_PUBLIC_KEY_X: ${ROUTER_AGGREGATED_PUBLIC_KEY_X} | ||
| ROUTER_AGGREGATED_PUBLIC_KEY_Y: ${ROUTER_AGGREGATED_PUBLIC_KEY_Y} | ||
| ROUTER_VERIFIABLE_SECRET_SHARING_COMMITMENT: ${ROUTER_VERIFIABLE_SECRET_SHARING_COMMITMENT} | ||
| ROUTER_VALIDATORS_LIST: ${ROUTER_VALIDATORS_LIST} | ||
| SENDER_ADDRESS: ${SENDER_ADDRESS} | ||
| ports: | ||
| - 8545:8545 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.