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/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 f516778..0000000 --- a/build.sh +++ /dev/null @@ -1,16 +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} . -rm -rf src/sdk-node 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); }) }) 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": {