title: Java 11 application as lightweight docker image
body: <p>Inspired by question <a href="https://stackoverflow.com/questions/53375613/">Why is the Java 11 base Docker image so large? (openjdk:11-jre-slim)</a> I found that this topic in Java world is still not settled.</p>
  
  <p>As for <code>07 Dec 2018</code> there are common issues/pitfalls (discussed in the ticket above):</p>
  
  <ul>
  <li><p>JRE is not distributed as a separate "package". Modules from JDK should be used instead</p></li>
  <li><p><a href="https://jdk.java.net/11/" rel="noreferrer">Oracle OpenJDK 11</a> doesn't support <a href="https://openjdk.java.net/projects/portola/" rel="noreferrer">Linux Alpine</a>, so <em>lightweight</em> images can't be easily created</p>
  
  <ul>
  <li>In the same time current stable Debian versions still doesn't have <a href="https://packages.debian.org/stable/java/" rel="noreferrer">Java 11 packages</a> (<a href="https://packages.ubuntu.com/bionic/java/" rel="noreferrer">Ubuntu has Java 10 installed</a> under openjdk-11 packages), that's why unstable sid versions are used for base docker images</li>
  </ul></li>
  <li><p>currently available Oracle openjdk-11 images build unstripped <code>libjvm.so</code> module, which has hundreds megabyte and must be stripped separately:</p>
  
  <ul>
  <li><a href="https://github.com/docker-library/openjdk/issues/217" rel="noreferrer">jlink runtime image size (specifically libjvm.so) created from openjdk is huge. Expected it to be much smaller.</a></li>
  <li>Solution: <a href="https://github.com/docker-library/openjdk/issues/217#issuecomment-436079779" rel="noreferrer">https://github.com/docker-library/openjdk/issues/217#issuecomment-436079779</a></li>
  </ul></li>
  </ul>
  
  <p>As a result of these issues even <em>slim</em> Oracle Java 11 base images are quite heavy and considered to be unstable: <a href="https://hub.docker.com/_/openjdk/" rel="noreferrer">https://hub.docker.com/_/openjdk/</a></p>
  
  <p>So the question is: </p>
  
  <p><strong>what are <em>optimized</em> or <em>recommended</em> ways to build and deliver Java 11 applications as docker images</strong>?</p>