joystream-node.Dockerfile 2.4 KB

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