title: Packaging war file into docker image in multiple layers
body: <p>I'm trying to put a Spring Boot application with war packaging into a docker image. The simplest way to get this can be using the following Dockerfile:</p>
  
  <pre><code>FROM adoptopenjdk/openjdk8:alpine-slim
  VOLUME /tmp
  COPY target/demo.war app.war
  ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.war"]
  </code></pre>
  
  <p>Following this approach I'm creating a big layer every time I change the project's source code. An alternative to this is to split the war into different docker layers as it is explained in this post: <a href="https://spring.io/blog/2018/11/08/spring-boot-in-a-container#a-better-dockerfile" rel="nofollow noreferrer">https://spring.io/blog/2018/11/08/spring-boot-in-a-container#a-better-dockerfile</a></p>
  
  <p>However, I'm afraid this is only possible with jar packaging and not with war. Am I right?</p>
  
  <p>Thanks in advance. </p>