Skip to content

🐳 Generic SpringBoot Docker files and image management 🍃

License

Notifications You must be signed in to change notification settings

intuit/unmazedboot

Repository files navigation

Generic SpringBoot Docker files and image management

Get started with your SpringBoot App in seconds. Use your favorite builder (Gradle or Maven) and choose your version of JRE - without needing to manage a complex maze of non-business logic steps in your Dockerfiles!

Benefits

  • No more copy-and-paste Dockerfile boilerplate code for your App's Runnable Jars!
    • We use the Builder Pattern for Gradle and Maven
  • Decoupled way to run your application in different JVMs
    • Our parameterized builds allows you to just select which JVM implementation to run!
  • Enterprise-friendly: Pick and choose the base images for your applications and push to your internal Docker Registry!

Current Support

  • Builder: Any Java build system.
    • Maven different base Operating Systems.
    • Gradle different base Operating Systems.
    • Bazel Waiting for contributions.
  • Linker: Any JDK 9+ with support to jlink to generate custom JVMs tailored for your application .jar
    • OpenJDK on Alpine musl`
    • OpenJDK on Debian glibc`
  • Runner: Any JVM available to the Custom JVMs generated by the Linker for your application.

All images are located at the DockerHub Intuit Repository.

Process

  1. Create a Dockerfile selecting the first stage the Builder image

This step requires the inspection of the build system used and the target JVM instructions used. For instance, the Kotlin tutorial uses Gradle and JDK8. For this reason, the builder image selected is using Gradle with JDK8 (See the dir samples/gradle-kotlin-jdk8-jre8 for details)

  1. If the project is to run in a JRE 8, then select the Runner image with the base OS desired

Since the Kotlin tutorial simply runs the application, then we just selected the base image with JRE8. That simplified the initial process of using the current tutorial.

  1. If your team is already required to migrate to JRE11 using the current code, then select a Linker image to create a custom JRE for your application based on the .jar produced by the Builder image.

This requires a matching base image with a matching OS type. For instance, if you will run on Alpine, then select a Linker image on Alpine with the JDK11 type (See the dir samples/gradle-java-jdk8-x-jre11-custom-alpine for details)

Builder

Implementation of a set of ONBUILD instructions that are reusable for any SpringBoot Application:

  • Injection of env vars such as GIT_SHA, GIT_BRANCH and BUILD_NUMBER for versioning.
  • Supports the following builders:
    • Gradle 4.x.x + openjdk 1.8
    • Maven 3.x.x + openjdk 1.8
    • Gradle 4.x.x + openjdk 1.11
    • Gradle 5.x.x + openjdk 1.12
    • Maven 3.x.x + openjdk 1.11
    • Maven 3.x.x + openjdk 1.12

Linker

Implementation of the call using jlink to create a custom VM for your application based on the generated Jar.

  • Custom Runners will consume the linker JVM.

Runner

Implementation of all tasks to execute a runnable WAR from a SpringBoot application.

  • Uses the built executable file to the appropriate di