title: How to test and deploy a Docker production image?
body: <p>I'm developing on Ruby on Rails and start using Docker for deployment for a month. </p>
  
  <p>The following are the steps I'm working on.</p>
  
  <blockquote>
    <ol>
    <li>dev on my laptop</li>
    <li>push to gitlab </li>
    <li>build a single image including test and production gems </li>
    <li>run rspec against this image </li>
    <li>(pass)push to registry, (fail) discard image</li>
    </ol>
  </blockquote>
  
  <p>With this workflow, I will have a single image that have all testing, development and production gems.</p>
  
  <p>The workflow that I find from talking with many people</p>
  
  <blockquote>
    <ol>
    <li>dev on my lap top</li>
    <li>push to gitlab</li>
    <li>build test image (all gems necessary for testing)</li>
    <li>run rspec against test image</li>
    <li>(pass)build another image for deployment without test gems and push to docker registry, (fail)discard the image</li>
    </ol>
  </blockquote>
  
  <p>With this method, I think it's violating the purpose of Docker (the image that being test should be indifference from the one that will be deploy).</p>
  
  <p>How to specify and implement an approach that test and push a production image?</p>