First of all, to remember what the environment depends on and what was annoying. Let's clone the Rails application and run it in the local environment.
■sample project
https://github.com/k-tetsuhiro/rails_docker_sample
This is a sample app created with ruby 2.7.2
and Rails 6.0.3.4
.
Try git clone this wherever you like.
Bring this to the point where you can run it with bundle exec rails s
!
I think that various problems will come out before moving it.
First of all, is 2.7.2 included in the local Ruby version?
If you are using rbenv, you can check with rbenv versions
.
$ rbenv versions
system
2.3.8
2.6.3
2.6.5
2.6.6
2.7.0
2.7.1
* 2.7.2 (set by /Users/kakuno/.rbenv/version)
How about that? If 2.7.2 is not included, you will first need to ** install ruby2.7.2 in your local environment **.
** Environmental dependence has come out at once! !! ** **
I think that it will be dependent on such an environment of local by the time it starts ・ Ruby version ・ Rails version ・ MySQL version ・ Yarn version etc...
That's why docker comes out here!
Rails application that someone has set up ** Save it as an image! !! ** **
If you include all the environments (Ruby, Rails, MySQL, etc ...) into an image, you won't be environment-dependent in the first place! It is an image!
As a further advantage, regardless of whether the local environment is Mac or Windows, ** Ruby and Rails are actually included in docker's image **, so it works on any machine!
I feel a great advantage in running with docker! So next time, how can I run my current Rails application with docker? I will explain here.
Recommended Posts