How to sandbox a rails application so that dependencies are installed locally without having to re-run bundle install


How to sandbox a rails application so that dependencies are installed locally without having to re-run bundle install



I'm trying to sandbox a rails application so that i can port it over to other machines without having to re-bundle. Is there a way for rails to pull in dependencies locally to self-sustain?




1 Answer
1



All dependencies are stored in the Gemfile.lock. All gems stored in ruby directory. You can run once bundle install to create Gemfile.lock. Then save Gemefile.lock and pack a directory with gems. After it you can copy your pack to server and deploy you application.





but if you move directory to a different environment, say docker, and say you don't have internet, you wouldn't be able to bundle install.
– user2167582
Jun 30 at 13:34





you don't need to run bundle install if have Gemfile.lock and have same ruby version and all gems according to Gemfile.lock.
– Artem Dorodovskyi
Jun 30 at 19:06





Also look at bundle package and bundle install --local commands. Maybe that what you need.
– Artem Dorodovskyi
Jun 30 at 19:10



bundle package


bundle install --local





is there a way you can specify --local for certain gems?
– user2167582
Jul 1 at 7:59





If you use in Gemfile gem "gem name", path: "/local/path". Then your gem will be installed from local machine
– Artem Dorodovskyi
Jul 1 at 10:11






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

PySpark - SparkContext: Error initializing SparkContext File does not exist

List of Kim Possible characters

Python Tkinter Error, “Too Early to Create Image”