title: How to write a dockerfile to add maven build on existing spring boot project which contains jdk
body: <p>My Boss is went to holiday for some days, I am a java developer I dont know much about docker (Only basic knowledge)</p>
  
  <p>I have the java Spring boot project , in that there is a Dockerfile at the root of the project.</p>
  
  <pre><code>FROM openjdk:8-jdk-alpine
  VOLUME /tmp
  ARG JAR_FILE=target/*.jar
  COPY ${JAR_FILE} app.jar
  ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
  </code></pre>
  
  <p>I want to add maven into the same, without modifiying the structure. and maven should clean package it.?</p>
  
  <p>for eg. docker build -t user/myimage .</p>
  
  <p>it should install maven and clean package my project automatically.
  without I need to run mvn clean package explicitly</p>
  
  <p>I have got few resources before from <a href="https://stackoverflow.com/questions/27767264/how-to-dockerize-maven-project-and-how-many-ways-to-accomplish-it">stackoverflow</a> but I cannot do experiment, I need code which can run thought the given jdk script mentioned previously.</p>
  
  <pre><code>FROM maven:3.6.0-jdk-11-slim AS build
  COPY src /home/app/src
  COPY pom.xml /home/app
  RUN mvn -f /home/app/pom.xml clean package
  </code></pre>
  
  <p>I request to you please give a equivalent script for Maven clean package so I can add it to the dockerfile which build my image. </p>