From 8c16dbf7027d96e5a78e0eca7a7b98ac5d9fced9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Mass=C3=A9?= Date: Wed, 7 Jun 2017 15:06:19 +0200 Subject: [PATCH] S2I scripts --- .s2i/bin/assemble | 20 ++++++++++++++++++++ .s2i/bin/run | 18 ++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100755 .s2i/bin/assemble create mode 100755 .s2i/bin/run diff --git a/.s2i/bin/assemble b/.s2i/bin/assemble new file mode 100755 index 0000000..c294828 --- /dev/null +++ b/.s2i/bin/assemble @@ -0,0 +1,20 @@ +#!/bin/bash + +if [ -z "$NPM_PACKAGE_TO_INSTALL" ]; then + echo "Error: NPM_PACKAGE_TO_INSTALL is not defined" + exit 1 +fi + +# Exit on any error +set -e + +echo "---> Installing application from NPM ..." +npm install "$NPM_PACKAGE_TO_INSTALL" + +# Trim package name (remove the version number) +package_name="${NPM_PACKAGE_TO_INSTALL%@*}" + +echo "---> Linking application ..." +ln -l "node_modules/$package_name" main + +fix-permissions ./ diff --git a/.s2i/bin/run b/.s2i/bin/run new file mode 100755 index 0000000..66f3a31 --- /dev/null +++ b/.s2i/bin/run @@ -0,0 +1,18 @@ +#!/bin/bash + +# Fail on any non-zero return code +set -e + +if [ -e "/opt/app-root/etc/generate_container_user" ]; then + source /opt/app-root/etc/generate_container_user +fi + +# Allow users to inspect/debug the builder image itself, by using: +# $ docker run -i -t openshift/centos-nodejs-builder --debug +# +[ "$1" == "--debug" ] && exec /bin/bash + +# Run NodeJS Server +echo "Running NodeJS Server..." +export NODE_ENV=production +run_node