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.
Substrate and Polkadot Stack Exchange is a question and answer site for developers building blockchains with the Substrate SDK. It only takes a minute to sign up.
Sign up to join this communityAs 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.