From 0b0ac787acc1a4ca237b30dd49a3dd4499c56c35 Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Thu, 16 Jan 2020 14:00:09 -0400 Subject: [PATCH 1/3] Build processmaker api dependency --- Dockerfile | 2 ++ build.sh | 1 - src/package.json | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5c4d5ff..2dafb50 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,4 +2,6 @@ FROM node:8.15.0 COPY /src /opt/executor WORKDIR /opt/executor RUN if [ ! -d "sdk-node" ]; then git clone --depth 1 https://github.com/ProcessMaker/sdk-node.git; fi +RUN cd /opt/executor/sdk-node; npm install +RUN cd /opt/executor/sdk-node; npm run-script build RUN npm install diff --git a/build.sh b/build.sh index f516778..063f1c2 100755 --- a/build.sh +++ b/build.sh @@ -13,4 +13,3 @@ pushd src popd docker build -t processmaker4/executor-node:${TAG} . -rm -rf src/sdk-node diff --git a/src/package.json b/src/package.json index fd1538a..8aefd91 100644 --- a/src/package.json +++ b/src/package.json @@ -4,7 +4,7 @@ "description": "", "main": "bootstrap.js", "dependencies": { - "process_maker_api": "file:./sdk-node" + "process_maker_api": "./sdk-node" }, "devDependencies": {}, "scripts": { From 9954de585018a93173eeaa3bf5d03f5237cfc0e6 Mon Sep 17 00:00:00 2001 From: Nolan Ehrstrom Date: Thu, 16 Jan 2020 10:11:04 -0800 Subject: [PATCH 2/3] Cleanup --- README.md | 15 ++++----------- build.sh | 15 --------------- 2 files changed, 4 insertions(+), 26 deletions(-) delete mode 100755 build.sh diff --git a/README.md b/README.md index d06a2b3..49950f8 100644 --- a/README.md +++ b/README.md @@ -5,19 +5,12 @@ A docker image that allows executing native ES6 in [ProcessMaker 4](https://gith ### Building To build from the master branch of the SDK at https://github.com/ProcessMaker/sdk-node. -This will build the image as processmaker/docker-executor-node:dev-master +This will build the image as processmaker4/executor-node:latest -`./build.sh` +`docker build -t processmaker4/executor-node:latest .` -You can specify a branch from the SDK repo with the BRANCH env var. -This will use that branch and build the as processmaker/docker-executor-node:feature-123 - -`BRANCH=feature/123 ./build.sh` - -You can specify a tag. -This will build the image from the master SDK branch as processmaker/docker-executor-node:test-123 - -`TAG=test-123 ./build.sh` +If you want to use a different branch or local build of the sdk, you can copy it to `./src/sdk-node` +and it will be used instead of cloning from github. ### Scripts The javascript must return either an object, a promise that resolves to an object, or nothing. diff --git a/build.sh b/build.sh deleted file mode 100755 index 063f1c2..0000000 --- a/build.sh +++ /dev/null @@ -1,15 +0,0 @@ -set -e -set -x - -BRANCH=${BRANCH:=master} -TAG=${TAG:=dev-${BRANCH//[\/]/-}} - -pushd src - if [[ ! -d "sdk-node" ]]; then - git clone --branch $BRANCH --depth 1 https://github.com/ProcessMaker/sdk-node.git - fi - rm -rf node_modules - rm -rf package-lock.json -popd - -docker build -t processmaker4/executor-node:${TAG} . From a8637f2bf183799bb887836975df3b87a6ff0c0d Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Thu, 16 Jan 2020 14:47:13 -0400 Subject: [PATCH 3/3] Catch script error and return it to the console --- src/bootstrap.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bootstrap.js b/src/bootstrap.js index f688556..c700938 100644 --- a/src/bootstrap.js +++ b/src/bootstrap.js @@ -42,7 +42,6 @@ Promise.all([getConfig, getData]).then(function(values) { // Nothing to output return writeScriptOutput(''); } else if (typeof result === 'object') { - result = Object.assign({}, data, result) return writeScriptOutput(JSON.stringify(result)); } else { console.log( @@ -51,5 +50,7 @@ Promise.all([getConfig, getData]).then(function(values) { "Got a " + typeof result) return } + }).catch((error) => { + console.error(error); }) })