When to use 'bundle package'


If you do 'bundle install vendor', gems will be installed in the
Then, you can deploy it to your production server.

When do you need to do 'bundle package'?
If you do 'bundle package', the gem files will be in vendor/cache.
Do you normally add vendor/cache to your git repository?



The difference is that the vendor/cache folder contains the gem itself, and exactly the version you are using too.

When you do bundle install on your production server, bundler will use the gem files from vendor/cache to install the gems. This means gems don’t need to be downloaded again, so they install a lot faster, but native extensions are still compiled for the platform you deploy on.

To your last question: yes, you commit vendor/cache to the repository.

Best regards

Peter De Berdt