Browse Source

add new docker files

Mokhtar Naamani 5 years ago
parent
commit
63950dd1fe
6 changed files with 52 additions and 8 deletions
  1. 3 0
      .gitignore
  2. 0 8
      Dockerfile
  3. 20 0
      build-with-docker.sh
  4. 16 0
      runtime_dockerfile
  5. 3 0
      setup.sh
  6. 10 0
      wasm_dockerfile

+ 3 - 0
.gitignore

@@ -8,6 +8,9 @@
 # These are backup files generated by rustfmt
 **/*.rs.bk
 
+# runtime built with docker build script
+joystream_runtime.wasm
+
 # JetBrains IDEs
 .idea
 

+ 0 - 8
Dockerfile

@@ -1,8 +0,0 @@
-# Build the image from https://github.com/joystream/docker-files/
-FROM rust-wasm
-
-WORKDIR /runtime
-
-COPY . /runtime
-
-RUN ./build.sh

+ 20 - 0
build-with-docker.sh

@@ -0,0 +1,20 @@
+#!/bin/bash
+
+# TODO: get this image from docker hub instead
+# Build the toolchain image - contains only the compiler environmet for building runtime
+docker build --tag wasm-toolchain --file ./wasm_dockerfile .
+
+# Build the runtime in a new image
+docker build --tag runtime-build --file ./runtime_dockerfile .
+
+# Create a non running container from the runtime build image
+docker create --name runtime-container runtime-build
+# Copy the compiled wasm blob from the docker container to our host
+docker cp runtime-container:/runtime/wasm/target/wasm32-unknown-unknown/release/joystream_node_runtime_wasm.compact.wasm joystream_runtime.wasm
+docker rm runtime-container
+
+# compute blake2_256 hash of the wasm blob - this should match the hash computed when the runtime file is
+# used to create a runtime upgrade proposal.
+# osx with: brew install b2sum; b2sum -b blake2b -l 256 joystream_runtime.wasm
+# ubuntu 17.0+ with: apt-get install coreutils; b2sum -l 256 joystream_runtime.wasm
+b2sum -l 256 joystream_runtime.wasm

+ 16 - 0
runtime_dockerfile

@@ -0,0 +1,16 @@
+FROM wasm-toolchain
+LABEL description="Joystream substrate runtime build"
+
+WORKDIR /runtime
+COPY . /runtime
+ENV TERM=xterm
+
+RUN rustup show
+
+# Ensure clean build
+RUN cargo clean
+RUN rm -fr target/
+RUN rm -fr wasm/target/
+
+# Build the runtime
+RUN cargo test && ./build.sh

+ 3 - 0
setup.sh

@@ -2,6 +2,9 @@
 
 set -e
 
+# Install OS dependencies
+curl https://getsubstrate.io -sSf | bash -s -- --fast
+
 echo "*** Initialising WASM build environment"
 
 if [ -z $CI_PROJECT_NAME ] ; then

+ 10 - 0
wasm_dockerfile

@@ -0,0 +1,10 @@
+FROM liuchong/rustup:1.34.0 AS builder
+LABEL description="Joystream wasm toolchain image"
+
+ENV TERM=xterm
+
+WORKDIR /setup
+COPY ./setup.sh /setup/
+ENV TERM=xterm
+
+RUN ./setup.sh