set openshift bundle_without variable
I spent far too long trying to figure out how to set OpenShift’s
BUNDLE_WITHOUT variable to limit the gems installed on my OpenShift container.
I searched far and wide through OpenShift’s documentation for information on how to do so.
At the time, the small amount of relevant helpdoc that existed turned out to not be particularly helpful, or I was doing something wrong.
There is some OpenShift doc explaining that you can set environment variables using the following command from the
I could’ve done that, I guess, but I didn’t want to.
I do most of this site’s coding on Nitrous.io and some stubborn part of me didn’t want to eat up disk space with the
Anyways, I figured out a way to set environment variables without having to use the
I can checkout the code from anywhere, change/add/remove variables, and I don’t have to install an additional tool to do so.
You should already have a
.openshift directory with some stuff in there.
.openshift/action_hooks/pre_build and open it in your favorite editor.
Inside, you’ll want to paste the following code.
Adding this code finally gave me the proper
bundle install command in the container that I was looking for.
$ git push openshift master ... remote: Waiting for stop to finish remote: Force clean build enabled - cleaning dependencies remote: Building git ref 'master', commit 1825024 remote: Building Ruby cartridge remote: bundle install --deployment --without 'development test' --path ./app-root/repo/vendor/bundle ...
You could use this same method to set other environment variables if you so desire. Bash to the rescue. Happy OpenShifting!