Browse Source

separate uild scripts

Mokhtar Naamani 4 years ago
parent
commit
cc06cdfb18
5 changed files with 41 additions and 58 deletions
  1. 22 0
      build-docker-images.sh
  2. 11 0
      build-npm-packages.sh
  3. 0 54
      build.sh
  4. 3 1
      package.json
  5. 5 3
      start.sh

+ 22 - 0
build-docker-images.sh

@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+
+set -e
+
+if ! command -v docker-compose &> /dev/null
+then
+  echo "docker-compose not found. Skipping docker image builds."
+  exit 0
+fi
+
+# Build joystream/apps docker image
+echo "Building 'joystream/apps' docker image..."
+docker-compose build colossus
+
+if [[ "$SKIP_JOYSTREAM_NODE" = 1 || "$SKIP_JOYSTREAM_NODE" = "true" ]]; then
+  echo "Skipping build of joystream/node docker image."
+  exit 0
+else
+  # TODO: Try to fetch a cached joystream/node image
+  # if one is found matching code shasum instead of building
+  docker-compose build joystream-node
+fi

+ 11 - 0
build-npm-packages.sh

@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+set -e
+
+yarn
+yarn workspace @joystream/types build
+yarn workspace query-node-root build
+# For now cli build is broken.. proceed anyway
+yarn workspace @joystream/cli build || :
+yarn workspace storage-node build
+yarn workspace pioneer build

+ 0 - 54
build.sh

@@ -1,54 +0,0 @@
-#!/usr/bin/env bash
-
-set -e
-
-yarn
-yarn workspace @joystream/types build
-yarn workspace query-node-root build
-# uncomment when updated
-# yarn workspace @joystream/cli build
-yarn workspace storage-node build
-# Not strictly needed during development, we run "yarn workspace pioneer start" to start
-# a dev instance, but will show highlight build issues
-yarn workspace pioneer build
-
-if ! command -v docker-compose &> /dev/null
-then
-  echo "docker-compose not found, skipping docker build!"
-else
-  # Build joystream/apps docker image
-  docker-compose build colossus
-
-  # Optionally build joystream/node docker image
-  # TODO: Try to fetch a cached joystream/node image
-  # if one is found matching code shasum instead of building
-  while true
-  do
-    read -p "Rebuild joystream/node docker image? (y/N): " answer2
-
-    case $answer2 in
-    [yY]* ) docker-compose build joystream-node
-            break;;
-
-    [nN]* ) break;;
-
-    * )     break;;
-    esac
-  done
-fi
-
-# Build cargo crates: native binaries joystream/node, wasm runtime, and chainspec builder.
-while true
-do
-  read -p "Compile joystream node native binary? (y/N): " answer1
-
-  case $answer1 in
-   [yY]* ) yarn cargo-checks
-           yarn cargo-build
-           break;;
-
-   [nN]* ) break;;
-
-   * )     break;;
-  esac
-done

+ 3 - 1
package.json

@@ -4,7 +4,9 @@
   "version": "1.0.0",
   "license": "GPL-3.0-only",
   "scripts": {
-    "build": "./build.sh",
+    "build": "./build-npm-packages.sh && ./build-docker-images.sh",
+    "build:packages": "./build-npm-packages.sh",
+    "build:docker": "./build-docker-images.sh",
     "start": "./start.sh",
     "cargo-checks": "devops/git-hooks/pre-commit && devops/git-hooks/pre-push",
     "cargo-build": "scripts/cargo-build.sh"

+ 5 - 3
start.sh

@@ -2,7 +2,8 @@
 set -e
 
 # Run a complete joystream development network on your machine using docker.
-# Make sure to run build.sh prior to running this script.
+# Make sure to run build-docker-images.sh prior to running this script to use
+# the local build.
 
 set -a
 . .env
@@ -40,10 +41,11 @@ export WS_PROVIDER_ENDPOINT_URI=ws://joystream-node:9944
 docker-compose up -d graphql-server
 docker-compose up -d processor
 
-echo "press Ctrl+C to shutdown the development network"
-echo 'run: `yarn workspace pioneer start` in a separate terminal to bring up an instance of pioneer and \
+echo 'run: `yarn workspace pioneer start` in a separate terminal to bring up an instance of pioneer and
 point your browser to http://localhost:3000/ to access the UI
 '
+echo "use Ctrl+C to shutdown the development network."
+
 while true; do 
   read
 done