joystream-node.Dockerfile 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. FROM liuchong/rustup:nightly AS rustup
  2. RUN rustup install nightly-2021-03-24
  3. RUN rustup default nightly-2021-03-24
  4. RUN rustup target add wasm32-unknown-unknown --toolchain nightly-2021-03-24
  5. RUN apt-get update && \
  6. apt-get install -y curl git gcc xz-utils sudo pkg-config unzip clang llvm libc6-dev
  7. FROM rustup AS builder
  8. LABEL description="Compiles all workspace artifacts"
  9. WORKDIR /joystream
  10. COPY . /joystream
  11. # Build all cargo crates
  12. # Ensure our tests and linter pass before actual build
  13. ENV WASM_BUILD_TOOLCHAIN=nightly-2021-03-24
  14. ARG TEST_NODE
  15. RUN echo "TEST_NODE=$TEST_NODE"
  16. RUN test -n "$TEST_NODE" && sed -i 's/MILLISECS_PER_BLOCK: Moment = 6000/MILLISECS_PER_BLOCK: Moment = 1000/' ./runtime/src/constants.rs
  17. RUN test -n "$TEST_NODE" && sed -i 's/SLOT_DURATION: Moment = 6000/SLOT_DURATION: Moment = 1000/' ./runtime/src/constants.rs
  18. RUN export ALL_PROPOSALS_PARAMETERS_JSON="$(test -n "$TEST_NODE" && cat ./tests/integration-tests/proposal-parameters.json)" &&\
  19. BUILD_DUMMY_WASM_BINARY=1 cargo clippy --release --all -- -D warnings && \
  20. cargo test --release --all && \
  21. cargo build --release
  22. FROM debian:buster
  23. LABEL description="Joystream node"
  24. WORKDIR /joystream
  25. COPY --from=builder /joystream/target/release/joystream-node /joystream/node
  26. COPY --from=builder /joystream/target/release/wbuild/joystream-node-runtime/joystream_node_runtime.compact.wasm /joystream/runtime.compact.wasm
  27. COPY --from=builder /joystream/target/release/chain-spec-builder /joystream/chain-spec-builder
  28. # confirm it works
  29. RUN /joystream/node --version
  30. # https://manpages.debian.org/stretch/coreutils/b2sum.1.en.html
  31. # RUN apt-get install coreutils
  32. # print the blake2 256 hash of the wasm blob
  33. RUN b2sum -l 256 /joystream/runtime.compact.wasm
  34. # print the blake2 512 hash of the wasm blob
  35. RUN b2sum -l 512 /joystream/runtime.compact.wasm
  36. EXPOSE 30333 9933 9944
  37. # Use these volumes to persits chain state and keystore, eg.:
  38. # --base-path /data
  39. # optionally separate keystore (otherwise it will be stored in the base path)
  40. # --keystore-path /keystore
  41. # if base-path isn't specified, chain state is stored inside container in ~/.local/share/joystream-node/
  42. # which is not ideal
  43. VOLUME ["/data", "/keystore"]
  44. ENTRYPOINT ["/joystream/node"]