Each time you change a file in your local application directory, the cache will be destroyed, forcing each step to restart after that, including the last bundle install.
bundle install 2. 1, , Gemfile 1 2, -).
1 , Gemfile, , bundle , , , , .
Dockerfile:
1.
WORKDIR /tmp
ADD ./Gemfile Gemfile
ADD ./Gemfile.lock Gemfile.lock
RUN bundle install
2.
ADD . opt/railsapp/
WORKIDR opt/rails/app