Skip to content

Instantly share code, notes, and snippets.

@connyay
Last active August 29, 2015 14:05
Show Gist options
  • Save connyay/79a5ba420e9cac541504 to your computer and use it in GitHub Desktop.
Save connyay/79a5ba420e9cac541504 to your computer and use it in GitHub Desktop.
Building node app with grunt on open shift
HOME=$OPENSHIFT_REPO_DIR
cd $OPENSHIFT_REPO_DIR
if ! which nvm >/dev/null; then
curl https://raw.githubusercontent.com/creationix/nvm/v0.13.1/install.sh | bash
fi
source ~/.nvm/nvm.sh
nvm install v0.10
mv _package.json package.json
mkdir -p "$OPENSHIFT_DATA_DIR"node_modules
ln -s "$OPENSHIFT_DATA_DIR"node_modules node_modules
npm install --production
./node_modules/bower/bin/bower install
./node_modules/grunt-cli/bin/grunt build
ls -1 | grep -E -v 'dist|node_modules|.tmp' | xargs rm -rf
mv dist/* .
rm -rf dist
export NODE_ENV="production"
cd $OPENSHIFT_REPO_DIR
mv package.json _package.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment