-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
67 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/bin/bash | ||
|
||
# Prevent running assemble in builders different than official STI image. | ||
# The official nodejs:6-onbuild already run npm install and use different | ||
# application folder. | ||
[ -d "/usr/src/app" ] && exit 0 | ||
|
||
set -e | ||
|
||
# FIXME: Linking of global modules is disabled for now as it causes npm failures | ||
# under RHEL7 | ||
# Global modules good to have | ||
# npmgl=$(grep "^\s*[^#\s]" ../etc/npm_global_module_list | sort -u) | ||
# Available global modules; only match top-level npm packages | ||
#global_modules=$(npm ls -g 2> /dev/null | perl -ne 'print "$1\n" if /^\S+\s(\S+)\@[\d\.-]+/' | sort -u) | ||
# List all modules in common | ||
#module_list=$(/usr/bin/comm -12 <(echo "${global_modules}") | tr '\n' ' ') | ||
# Link the modules | ||
#npm link $module_list | ||
|
||
safeLogging () { | ||
if [[ $1 =~ http[s]?://.*@.*$ ]]; then | ||
echo $1 | sed 's/^.*@/redacted@/' | ||
else | ||
echo $1 | ||
fi | ||
} | ||
|
||
shopt -s dotglob | ||
echo "---> Installing application source ..." | ||
|
||
if [ ! -z $HTTP_PROXY ]; then | ||
echo "---> Setting npm http proxy to" $(safeLogging $HTTP_PROXY) | ||
npm config set proxy $HTTP_PROXY | ||
fi | ||
|
||
if [ ! -z $http_proxy ]; then | ||
echo "---> Setting npm http proxy to" $(safeLogging $http_proxy) | ||
npm config set proxy $http_proxy | ||
fi | ||
|
||
if [ ! -z $HTTPS_PROXY ]; then | ||
echo "---> Setting npm https proxy to" $(safeLogging $HTTPS_PROXY) | ||
npm config set https-proxy $HTTPS_PROXY | ||
fi | ||
|
||
if [ ! -z $https_proxy ]; then | ||
echo "---> Setting npm https proxy to" $(safeLogging $https_proxy) | ||
npm config set https-proxy $https_proxy | ||
fi | ||
|
||
# Change the npm registry mirror if provided | ||
if [ -n "$NPM_MIRROR" ]; then | ||
npm config set registry $NPM_MIRROR | ||
fi | ||
|
||
echo "---> Building your Node application from source" | ||
npm install | ||
|
||
# Fix source directory permissions | ||
fix-permissions ./ |