From ca068145fef7e3dba83653f9bf11d50a830b0412 Mon Sep 17 00:00:00 2001 From: Greg Zaitsev Date: Mon, 29 Jul 2024 15:43:01 -0400 Subject: [PATCH] Add baedeker workflow - in progress --- .baedeker/Dockerfile | 25 ++++++++++--------------- .baedeker/util/runtimeUpgrade.js | 2 +- .gitignore | 5 ++++- docker-compose-baedeker.yml | 2 +- scripts/localnet-baedeker.sh | 5 +++++ 5 files changed, 21 insertions(+), 18 deletions(-) diff --git a/.baedeker/Dockerfile b/.baedeker/Dockerfile index fdd503945..0525c79c5 100644 --- a/.baedeker/Dockerfile +++ b/.baedeker/Dockerfile @@ -2,28 +2,23 @@ FROM ubuntu:20.04 WORKDIR /substrate # show backtraces -# ENV RUST_BACKTRACE 1 +ENV RUST_BACKTRACE 1 # Necessary libraries for Rust execution -# RUN apt-get update && \ -# apt-get install -y curl build-essential protobuf-compiler clang git && \ -# rm -rf /var/lib/apt/lists/* +RUN apt-get update && \ + apt-get install -y curl build-essential protobuf-compiler clang git && \ + rm -rf /var/lib/apt/lists/* # Install cargo and Rust -# RUN curl https://sh.rustup.rs -sSf | sh -s -- -y -# ENV PATH="/root/.cargo/bin:${PATH}" +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y +ENV PATH="/root/.cargo/bin:${PATH}" # Capture dependencies -# COPY . . +COPY . . # Cargo build -# RUN cargo build --release -# EXPOSE 9946 -#RUN cp -R ./target/* /target +RUN cargo build --release +EXPOSE 9946 # Run the Substrate node binary -#CMD ["./scripts/localnet-baedeker.sh"] - -RUN echo "hello from docker" > a.txt - -CMD ["bash"] +CMD ["./scripts/localnet-baedeker.sh"] diff --git a/.baedeker/util/runtimeUpgrade.js b/.baedeker/util/runtimeUpgrade.js index d9cc52753..1bb5e706e 100644 --- a/.baedeker/util/runtimeUpgrade.js +++ b/.baedeker/util/runtimeUpgrade.js @@ -4,7 +4,7 @@ const fs = require('fs'); const NODE_URL = 'ws://127.0.0.1:9946'; const SUDO_ACCOUNT_SEED = '//Alice'; -const WASM_FILE_PATH = '../../target/release/wbuild/node-subtensor-runtime/node_subtensor_runtime.wasm'; +const WASM_FILE_PATH = '../../wasm/node_subtensor_runtime.wasm'; async function main() { // Create a provider connected to the local node diff --git a/.gitignore b/.gitignore index f394de80c..4d39e2274 100644 --- a/.gitignore +++ b/.gitignore @@ -43,4 +43,7 @@ specs/*.json bt.snap # localnet spec -scripts/specs/local.json \ No newline at end of file +scripts/specs/local.json + +# Copied wasm files +wasm \ No newline at end of file diff --git a/docker-compose-baedeker.yml b/docker-compose-baedeker.yml index 191144f7f..453e2b6d5 100644 --- a/docker-compose-baedeker.yml +++ b/docker-compose-baedeker.yml @@ -3,7 +3,7 @@ services: ports: - 9946:9946 volumes: - - ./target:/substrate + - ./wasm:/substrate/wasm build: context: . dockerfile: ./.baedeker/Dockerfile diff --git a/scripts/localnet-baedeker.sh b/scripts/localnet-baedeker.sh index 834b619bc..c85719e36 100755 --- a/scripts/localnet-baedeker.sh +++ b/scripts/localnet-baedeker.sh @@ -1,5 +1,10 @@ #!/bin/bash +# Copy wasm runtime +ls -la ./target/release/wbuild/node-subtensor-runtime/ +mkdir -p ./wasm +cp ./target/release/wbuild/node-subtensor-runtime/*.wasm ./wasm + : "${BUILD_BINARY:=1}" # : "${FEATURES:=pow-faucet}"