On continuous integration, I have already installed all the gems needed to run tests and compile assets and such.
Now, I want to reuse the installed gems that are cached on startup and then extracted for each job that needs them.
When I get to the final step I'd like to clean out all the test and development gems from the vendor/bundle in the resulting docker image.
BUNDLE_DEPLOYMENT=true BUNDLE_CLEAN=true BUNDLE_WITHOUT=development,test bundle install
doesn't seem to do the job I expected it to do.
Is there another way to clean the gems from the vendor/bundle
directory that belongs in the environment I want to skip for production deployment?
From bundler documentation:
without (BUNDLE_WITHOUT): A
:
-separated list of groups whose gems bundler should not install.
You separated groups using coma, not colon which is why this did not work. If you use --without
instead, list would be space separated.