title: Make Docker build stop after if RUN fails in multi-stage build
body: <p>I have a Dockerfile which has multiple stages. An intermediate stage runs tests. If the test fails, I would like the build to stop but it continues given below. You can see output where it continues beyond failed RUN command.</p>
  
  <pre><code># Base image
  FROM python:3.5 as base
  
  
  # For running tests
  FROM base
  WORKDIR /root
  
  RUN mkdir /root/src
  ADD src/requirements.txt /root/src
  RUN pip install -r /root/src/requirements.txt
  
  ADD . /root
  RUN ["/bin/bash", "-c", "cd test; ./run-tests.sh"]
  
  
  # For publishing src files
  
  FROM base
  ADD src /root/src
  ADD .pypirc /root/.pypirc
  
  
  WORKDIR /root/src
  
  CMD python setup.py sdist upload -r local
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>Step 6/13 : RUN pip install -r /root/src/requirements.txt
   ---&gt; Using cache
   ---&gt; 56fa7fc2f2e8
  Step 7/13 : ADD . /root
   ---&gt; 74c52977edcf
  Step 8/13 : RUN ["/bin/bash", "-c", "cd test; ./run-tests.sh"]
   ---&gt; Running in 68a184ab54af
  ...
  ----------------------------------------------------------------------
  Ran 1 test in 10.122s
  
  FAILED (failures=1)
  The command '/bin/bash -c cd test; ./run-tests.sh' returned a non-zero code: 1
  running sdist
  running egg_info
  ...
  running upload
  Submitting dist/&lt;artifact-name&gt;-2.6.1.2.tar.gz to https://&lt;subdomain&gt;.jfrog.io/&lt;context&gt;/api/pypi/python-local
  ...
  </code></pre>