When I push my code to OpenShift, it looks like it\'s installing my devDependencies
which takes forever. I would really love to set it up so it wil
Found a way to specify it in source instead of during app creation. The benefit (for me) over an env var is that it applies to all ways to launch the app, including a "Launch on OpenShift" button.
Create an .openshift/action_hooks/pre_build
file:
#!/bin/bash
# This makes npm not install devDependencies.
echo 'Enabling npm production'
echo 'production = true' >> $OPENSHIFT_REPO_DIR/.npmrc
That's it! I've tested and it does affect npm for this build, and the .npmrc disappears if you remove this hook in the future.
(Obviously I could also achieve this by simply adding an .npmrc
to my repo, but do not want to affect people checking out the source and running npm install
, only how it works on OpenShift.)