Whats the difference between bundle install --deployment and bundle pack
Solution 1
Have a look at the description of the two on Bundler's site.
Running bundle install --deployment
is to be run in the production environment, but will grab the gems from rubygems when run. Read more here under the 'Deploying Your Application' heading for the purpose of the --deployment
flag.
bundle package
is similar to the old rake rails:gems:freeze
command from Rails 2.3. It grabs the gems and packages them in vendor/cache. From the bundler site here:
You can use this to avoid a dependency on rubygems.org at deploy time, or if you have private gems that are not in a public repository
Solution 2
I use bundle install --path vendor/bundle
in development mode.
bundle install --deployment
will lock yor Gemfile.lock and will not update it when you change your Gemfile, so never use deployment option on development environment.
bundle install --no-deployment
will disable bundle deployment mode.
You can read that post about bundle usage in right way.
Solution 3
I explained the reasoning behind the --deployment mode flag at pretty great length in a talk I gave at RailsConf 2011. This blog post contains my notes for that talk, and (I hope) covers all of the reasoning behind the way --deployment works: http://andre.arko.net/2011/06/11/deploying-with-bundler-notes/
Comments
-
concept47 over 3 years
I know they both put the gems in your app in different locations but it seems as if bundle install --deployment does a more thorough job. Can I just add the vendor/bundle directory it creates to version control and be done?
-
concept47 almost 13 yearsGreat response helped me understand the above response better
-
concept47 almost 13 yearsThank you for that, it took me reading and re-reading the doc to get a full understanding of what you were saying ... had to wrap my head around the fact that you still have to run 'bundle install' on the production server, even if you use bundle pack and check the vendor/cache folder into source control
-
Ricardo Castañeda about 12 yearsThanks, the --no-deployment explanation helped me to run in localhost a downloaded app from the server.
-
Mojo almost 12 yearsbundle --install deployment grabs the gems from rubygems. But what if you've done a bundle package and your vendor/cache is primed with gems? It looks to me like bundle install --deployment continues to hit rubygems to get gems.
-
Rick Smith over 8 yearsThanks for the link. This post is now a few years old, are there any changes I should be aware of?