Spring Boot / Kotlin / Gradle / Jib Workbench
… what it’s for
Demonstrate how to use the Jib Gradle Plugin to create a docker container.
Jib offers a new approach in generating Docker images for Java applications by by separating libraries, classes and resources into separate layers which speeds up deployment and reduces the size of the image layers that change often during application development. You can read more about Jib on the Jib GitHub Project page.
In addition the gradle script contains all necessary setup to use Kotlin and Spring Boot 2 for the implementation.
Due to a problem in Version 0.9.8 of Jib it is not
possible to use the openjdk base image. By default Jib uses
… how it’s setup
In order to be able to push the generated docker image to a registry you need to set the
gradle.properties file. In case of the Docker Hub registry this is your username. By default the Jib plugin
will use the authentication mechanism and credentials provided by the configuration of your docker configuration
deployments folder contains a simple kubernetes deployment descriptor for this application. You have to update
the image name in order to use your image.
… how it’s build
Build and push an image by issuing
To build the image and create a local Docker daemon use
… how it’s structured
The Gradle build script is split into multiple files that can be found in the
Configures the Jib plugin.
Is responsible for all things related to Kotlin.
Sets up Gradle to use JUnit 5 to run tests.
… what it can do
Since the purpose of the project is to demonstrate the build mechanism the application itself only provides two simple
In addition the Spring Actuator package is included in the application.