What exactly is the difference between bundle install --deployment
and bundle install --path vendor/bundle
?
I've read the link below which explains what deployment mode does, but I'm still not sure, because both of these commands install the gems to the path vendor/bundle
.
My vague understanding is that --deployment
sets the Gemfile.lock
into place, so that it can't be updated anymore. But please correct me if I'm wrong.
https://bundler.io/man/bundle-install.1.html#DEPLOYMENT-MODE
Basically, bundle install --deployment
doesn't even look at your Gemfile
and will just install all dependencies from your Gemfile.lock
(and will fail if your Gemfile.lock
has dependency issues). bundle install --path
does a regular bundle install
with a specific target folder (which, in your example, is coincidentally the same as the target folder for bundle install --deployment
). The main difference in your example is that bundle install
will try to change your Gemfile.lock
if your Gemfile
has changed.
The reason that Bundler installs to vendor/bundle
in deployment mode is that a regular bundle install
will install gems to a shared folder every project uses. It's preferrable to isolate your dependencies between projects and deployments.