Repository: chainx-org/ChainX (language: rust)

Issue:
Docker build failed at the latest develop branch
Docker build failed since https://github.com/chainx-org/ChainX/commit/8448f4011243c29147a0349b54a444e04395142b, pinning to a new rust toolchain probably helps.


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/pre_release.yml b/.github/workflows/pre_release.yml
index 3ddea0c95..147b7db35 100644
--- a/.github/workflows/pre_release.yml
+++ b/.github/workflows/pre_release.yml
@@ -11,12 +11,12 @@ jobs:
     name: Prepare wasm
     runs-on: ubuntu-latest
     container:
-      image: chainxorg/srtool:nightly-2020-10-27
+      image: chainxorg/srtool:nightly-2021-03-01
       volumes:
         - ${{ github.workspace }}:/build
     env:
       PACKAGE: chainx-runtime
-      RUSTC_VERSION: nightly-2020-10-27
+      RUSTC_VERSION: nightly-2020-03-01
 
     steps:
     - uses: actions/checkout@v2
diff --git a/Dockerfile b/Dockerfile
index 1a5e38e52..7ac188f28 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -4,7 +4,7 @@ LABEL description="The build stage for ChainX. We create the ChainX binary in th
 
 ARG PROFILE=release
 ARG APP=chainx
-ARG RUSTC_VERSION=nightly-2020-09-30
+ARG RUSTC_VERSION=nightly-2021-03-01
 
 WORKDIR /$APP
 
@@ -40,7 +40,7 @@ RUN mv /usr/share/ca* /tmp && \
 
 RUN rm -rf /usr/bin /usr/sbin
 
-EXPOSE 20222 8086 8087
+EXPOSE 20222 8086 8087 9615
 
 VOLUME ["/data"]
 
diff --git a/scripts/build_wasm.sh b/scripts/build_wasm.sh
deleted file mode 100755
index 7fdaeb6f9..000000000
--- a/scripts/build_wasm.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env bash
-
-docker run --rm -it -e PACKAGE=chainx-runtime -v $PWD:/build -v /tmp/cargo:/cargo-home chainxorg/srtool:nightly-2020-09-30
diff --git a/scripts/build_wasm_runtime.sh b/scripts/build_wasm_runtime.sh
new file mode 100755
index 000000000..d6da77257
--- /dev/null
+++ b/scripts/build_wasm_runtime.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+
+# Make sure the script is running from the root directory of ChainX.
+cd "$(dirname "${BASH_SOURCE[0]}")"
+cd ..
+
+RUSTC_VERSION=nightly-2021-03-01
+PACKAGE=chainx-runtime
+
+timestamp=$(date +%s)
+toolchain_backup=rust-toolchain.bak."$timestamp"
+
+# Use the toolchain specified in chainxorg/srtool instead of the one in ChainX
+if [ -f rust-toolchain ]; then
+  mv rust-toolchain "$toolchain_backup"
+fi
+
+docker run --rm -it -e PACKAGE="$PACKAGE" -e BUILD_OPTS=" " -v $PWD:/build -v /tmp/out:/out -v /tmp/cargo:/cargo-home chainxorg/srtool:$RUSTC_VERSION
+
+if [ -f "$toolchain_backup" ]; then
+  mv "$toolchain_backup" rust-toolchain
+fi


Test patch: