title: Build docker image with jetty - when should I build?
body: <p>I'm working on 'dockerizing' a java web application (<a href="https://github.com/kermitt2/grobid" rel="nofollow">https://github.com/kermitt2/grobid</a>) which I want to run using jetty. </p>
  
  <p>Here the Dockerfile: </p>
  
  <pre><code>FROM jetty:9.3-jre8
  ADD ./grobid-home/target/grobid-home-0.4.1-SNAPSHOT.zip /opt
  
  RUN unzip /opt/grobid-home-0.4.1-SNAPSHOT.zip -d /opt &amp;&amp; \
      rm /opt/grobid-home-0.4.1-SNAPSHOT.zip &amp;&amp; \
      apt-get update &amp;&amp; apt-get -y --no-install-recommends install libxml2
  
  COPY ./grobid-service/target/grobid-service-0.4.1-SNAPSHOT.war \ 
       /var/lib/jetty/webapps/ROOT.war
  </code></pre>
  
  <p>The current docker image works perfectly, but it requires the application to be built before (it cannot be built from the fresh git clone). 
  For example I could not run a build with the docker HUB build system. </p>
  
  <p>What would be the prefereable approach? Build the maven project while building the image or run docker after the build as been successfully finished? </p>