title: Why would you copy your Gemfile.lock into Docker, then immediately overwrite it?
body: <p>Why would you copy <code>Gemfile.lock</code>, run <code>bundle install</code> to create a new <code>Gemfile.lock</code>, then immediately copy the current directory which contains the original <code>Gemfile.lock</code> and overwrite the <code>Gemfile.lock</code> that was just created by Bundler within the Docker container? </p>
  
  <p>Also why can you get away with not having <code>EXPOSE 3000</code>?</p>
  
  <p><a href="https://docs.docker.com/compose/rails/#define-the-project" rel="noreferrer">https://docs.docker.com/compose/rails/#define-the-project</a></p>
  
  <pre><code>FROM ruby:2.3.3
  RUN apt-get update -qq &amp;&amp; apt-get install -y build-essential libpq-dev nodejs
  RUN mkdir /myapp
  WORKDIR /myapp
  COPY Gemfile /myapp/Gemfile
  COPY Gemfile.lock /myapp/Gemfile.lock
  RUN bundle install
  COPY . /myapp
  </code></pre>
  
  <p>That isn't the only place it does that. It's also done here, which seems pretty official. Maybe I'm missing a fundamental aspect of Docker?</p>
  
  <p><a href="https://hub.docker.com/_/ruby/" rel="noreferrer">https://hub.docker.com/_/ruby/</a></p>
  
  <pre><code>COPY Gemfile Gemfile.lock ./
  RUN bundle install
  
  COPY . .
  </code></pre>