5

I am using substrate-node-template and recently I added a new pallet. Now I need to build a docker file because I would like to send it for testing.

Any information?

Thank you.

2
  • Linux or macOS?
    – Bruno
    Sep 6, 2022 at 14:22
  • It is mac......
    – P.E
    Sep 6, 2022 at 15:00

1 Answer 1

1

As you probably saw; there is a docker-compose file in the Repo which you can use in CI. It is not ideal since it re-builds every time.

Creating a docker image for the node can be done as shown here:

FROM paritytech/ci-linux:production as build

WORKDIR /code
COPY . .
RUN cargo build --release

FROM ubuntu:20.04
WORKDIR /node

# Copy the node binary.
COPY --from=build /code/target/release/node-template .

# Install root certs, see: https://github.com/paritytech/substrate/issues/9984
RUN apt update && \
    apt install -y ca-certificates && \
    update-ca-certificates && \
    apt remove ca-certificates -y && \
    rm -rf /var/lib/apt/lists/*

EXPOSE 9944
# Exposing unsafe RPC methods is needed for testing but should not be done in
# production.
CMD [ "./node-template", "--dev", "--ws-external", "--rpc-methods=Unsafe" ]

It is possible like this to combine it with the frontend template.
In any case; this should not be used in production since it exposes unsafe RPS methods which is good for testing.
A more professional Dockerfile can be found in the Polkadot Repo.

1
  • What? You modified someone else's question and pasted your question in there instead? Besides this it is extremely self explanatory "failed to make network request". Sep 2 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.