joystream-node.Dockerfile 2.0 KB

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