joystream-node.Dockerfile 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. FROM liuchong/rustup:nightly AS rustup
  2. RUN rustup install nightly-2021-02-20
  3. RUN rustup default nightly-2021-02-20
  4. RUN rustup target add wasm32-unknown-unknown --toolchain nightly-2021-02-20
  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-02-20
  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; exit 0
  17. RUN test -n "$TEST_NODE" && sed -i 's/SLOT_DURATION: Moment = 6000/SLOT_DURATION: Moment = 1000/' ./runtime/src/constants.rs; exit 0
  18. RUN test -n "$TEST_NODE" && export ALL_PROPOSALS_PARAMETERS_JSON="$(cat ./tests/integration-tests/proposal-parameters.json)";\
  19. echo "ALL_PROPOSALS_PARAMETERS_JSON=$ALL_PROPOSALS_PARAMETERS_JSON" && \
  20. BUILD_DUMMY_WASM_BINARY=1 cargo clippy --release --all -- -D warnings && \
  21. cargo test --release --all && \
  22. cargo build --release
  23. FROM debian:buster
  24. LABEL description="Joystream node"
  25. WORKDIR /joystream
  26. COPY --from=builder /joystream/target/release/joystream-node /joystream/node
  27. COPY --from=builder /joystream/target/release/wbuild/joystream-node-runtime/joystream_node_runtime.compact.wasm /joystream/runtime.compact.wasm
  28. COPY --from=builder /joystream/target/release/chain-spec-builder /joystream/chain-spec-builder
  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"]