From a185622ece504a7cb246c25a4ef39be7f7a8114d Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 29 Oct 2024 17:13:08 +0100 Subject: [PATCH 1/4] [pallet-revive] rpc server add docker file --- substrate/frame/revive/rpc/.dockerignore | 7 +++++++ substrate/frame/revive/rpc/Dockerfile | 23 +++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 substrate/frame/revive/rpc/.dockerignore create mode 100644 substrate/frame/revive/rpc/Dockerfile diff --git a/substrate/frame/revive/rpc/.dockerignore b/substrate/frame/revive/rpc/.dockerignore new file mode 100644 index 000000000000..c58599e3fb72 --- /dev/null +++ b/substrate/frame/revive/rpc/.dockerignore @@ -0,0 +1,7 @@ +doc +**target* +.idea/ +Dockerfile +.dockerignore +.local +.env* diff --git a/substrate/frame/revive/rpc/Dockerfile b/substrate/frame/revive/rpc/Dockerfile new file mode 100644 index 000000000000..f78b99e9c245 --- /dev/null +++ b/substrate/frame/revive/rpc/Dockerfile @@ -0,0 +1,23 @@ +FROM rust AS builder + +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y \ + protobuf-compiler + +WORKDIR /polkadot +COPY . /polkadot +RUN cargo build --locked --release -p pallet-revive-eth-rpc --bin eth-rpc + +FROM docker.io/parity/base-bin:latest +COPY --from=builder /polkadot/target/release/eth-rpc /usr/local/bin + +USER root +RUN useradd -m -u 1001 -U -s /bin/sh -d /polkadot polkadot && \ +# unclutter and minimize the attack surface + rm -rf /usr/bin /usr/sbin && \ +# check if executable works in this container + /usr/local/bin/eth-rpc --help + +USER polkadot +EXPOSE 8545 +ENTRYPOINT ["/usr/local/bin/eth-rpc"] From e81094e5d81743959e8aaffd39abe7580563f982 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 29 Oct 2024 16:19:14 +0000 Subject: [PATCH 2/4] Update from pgherveou running command 'prdoc --audience runtime_dev --bump minor' --- prdoc/pr_6278.prdoc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 prdoc/pr_6278.prdoc diff --git a/prdoc/pr_6278.prdoc b/prdoc/pr_6278.prdoc new file mode 100644 index 000000000000..d841129aa063 --- /dev/null +++ b/prdoc/pr_6278.prdoc @@ -0,0 +1,14 @@ +title: '[pallet-revive] rpc server add docker file' +doc: +- audience: Runtime Dev + description: |- + Add a docker for pallet-revive eth-rpc + + Tested with + ``` + sudo docker build . -t eth-rpc -f substrate/frame/revive/rpc/Dockerfile + sudo docker run --network="host" -e RUST_LOG="info,eth-rpc=debug" eth-rpc + ``` +crates: +- name: pallet-revive-eth-rpc + bump: minor From 5e5d2626dca4aa50da053673ba1547c9266e6d66 Mon Sep 17 00:00:00 2001 From: PG Herveou Date: Tue, 29 Oct 2024 18:12:35 +0100 Subject: [PATCH 3/4] Update substrate/frame/revive/rpc/Dockerfile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Alexander Theißen --- substrate/frame/revive/rpc/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/revive/rpc/Dockerfile b/substrate/frame/revive/rpc/Dockerfile index f78b99e9c245..799697189425 100644 --- a/substrate/frame/revive/rpc/Dockerfile +++ b/substrate/frame/revive/rpc/Dockerfile @@ -6,7 +6,7 @@ RUN apt-get update && \ WORKDIR /polkadot COPY . /polkadot -RUN cargo build --locked --release -p pallet-revive-eth-rpc --bin eth-rpc +RUN cargo build --locked --profile production -p pallet-revive-eth-rpc --bin eth-rpc FROM docker.io/parity/base-bin:latest COPY --from=builder /polkadot/target/release/eth-rpc /usr/local/bin From 1818776f93fcd4b8fc62309657840f2189fc899e Mon Sep 17 00:00:00 2001 From: PG Herveou Date: Tue, 29 Oct 2024 18:12:44 +0100 Subject: [PATCH 4/4] Update substrate/frame/revive/rpc/Dockerfile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Alexander Theißen --- substrate/frame/revive/rpc/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/revive/rpc/Dockerfile b/substrate/frame/revive/rpc/Dockerfile index 799697189425..3ad476651d83 100644 --- a/substrate/frame/revive/rpc/Dockerfile +++ b/substrate/frame/revive/rpc/Dockerfile @@ -9,7 +9,7 @@ COPY . /polkadot RUN cargo build --locked --profile production -p pallet-revive-eth-rpc --bin eth-rpc FROM docker.io/parity/base-bin:latest -COPY --from=builder /polkadot/target/release/eth-rpc /usr/local/bin +COPY --from=builder /polkadot/target/production/eth-rpc /usr/local/bin USER root RUN useradd -m -u 1001 -U -s /bin/sh -d /polkadot polkadot && \