joystream-node.Dockerfile 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. RUN BUILD_DUMMY_WASM_BINARY=1 cargo clippy --release --all -- -D warnings && \
  15. cargo test --release --all && \
  16. cargo build --release
  17. FROM debian:buster
  18. LABEL description="Joystream node"
  19. WORKDIR /joystream
  20. COPY --from=builder /joystream/target/release/joystream-node /joystream/node
  21. COPY --from=builder /joystream/target/release/chain-spec-builder /joystream/chain-spec-builder
  22. COPY --from=builder /joystream/target/release/wbuild/joystream-node-runtime/joystream_node_runtime.compact.wasm /joystream/runtime.compact.wasm
  23. COPY --from=builder /joystream/target/aarch64-unknown-linux-gnu/release/joystream-node /joystream/node
  24. COPY --from=builder /joystream/target/aarch64-unknown-linux-gnu/release/chain-spec-builder /joystream/chain-spec-builder
  25. COPY --from=builder /joystream/target/aarch64-unknown-linux-gnu/release/wbuild/joystream-node-runtime/joystream_node_runtime.compact.wasm /joystream/runtime.compact.wasm
  26. COPY --from=builder /joystream/target/arm-unknown-linux-gnueabihf/release/joystream-node /joystream/node
  27. COPY --from=builder /joystream/target/arm-unknown-linux-gnueabihf/release/chain-spec-builder /joystream/chain-spec-builder
  28. COPY --from=builder /joystream/target/arm-unknown-linux-gnueabihf/release/wbuild/joystream-node-runtime/joystream_node_runtime.compact.wasm /joystream/runtime.compact.wasm
  29. # confirm it works
  30. RUN /joystream/node --version
  31. # https://manpages.debian.org/stretch/coreutils/b2sum.1.en.html
  32. # RUN apt-get install coreutils
  33. # print the blake2 256 hash of the wasm blob
  34. RUN b2sum -l 256 /joystream/runtime.compact.wasm
  35. # print the blake2 512 hash of the wasm blob
  36. RUN b2sum -l 512 /joystream/runtime.compact.wasm
  37. EXPOSE 30333 9933 9944
  38. # Use these volumes to persits chain state and keystore, eg.:
  39. # --base-path /data
  40. # optionally separate keystore (otherwise it will be stored in the base path)
  41. # --keystore-path /keystore
  42. # if base-path isn't specified, chain state is stored inside container in ~/.local/share/joystream-node/
  43. # which is not ideal
  44. VOLUME ["/data", "/keystore"]
  45. ENTRYPOINT ["/joystream/node"]