Jib, the open source tool for building space efficient and optimized Docker and OCI images for Java applications, has been constantly adding new features to further improve the developer and CI/CD experiences. Some of the highlights include the Jib Plugin Extension Framework, native support for popular application frameworks, CI/CD performance improvements, and enhanced development experience on a local Kubernetes with Skaffold.
Jib Plugin Extension Framework
Jib’s true power is in its ability to build optimized Docker and OCI images for Java applications reproducibly, in a declarative manner, applying container best practices, and without a Docker daemon. With the new Jib Plugin Extension Framework, users can now extend Jib to tweak all aspects of a Java application image. The extension framework is based on the Container Build Plan Specification, a general purpose, tool-agnostic spec to describe an image's build plan. The core Jib team has already released a few useful extensions like the GraalVM native image extension for a fast startup of Java applications running inside containers. New extensions can be built and contributed as thrid-party plugins for both Maven and Gradle.
Native Support for Application Frameworks
Some of the popular application frameworks like Spring Boot and Quarkus now enjoy native support from Jib. For Spring Boot, the packaged containerizing-mode in Jib provides out-of-the-box support by containerizing the original thin application JAR rather than the fat Spring Boot JAR, which tends to be unsuitable for containerization. The Jib core team has also published first-party Jib Maven and Gradle extensions for Quarkus which enable full control on how to configure and build Quarkus images. Note that these extensions are still experimental and may fail to build complex projects.
Enhanced CI/CD Support
Since Jib does not rely on the Docker daemon, it can create and push an image without downloading its corresponding base image. For instance, a typical Java based Dockerfile would contain a line like FROM openjdk:11-jre-slim
to specify the base image. The Docker daemon would then have to download this base image if it is not present in the Docker image cache, which is typically the case in a CI/CD environment. But Jib has some built-in smarts that makes a best case effort to skip downloading the base images. Incorporating Jib in the CI/CD pipelines can thus reduce build times, and save network bandwidth and storage space.
Local Kubernetes Development Support with Skaffold
Skaffold, an optimized tool that provides fast and repeatable local Kubernetes development workflow, can now be integrated with Jib. This integration enables Skaffold’s zero-config auto sync for Java images. With auto sync, Jib can sync class file changes and resource file changes to a running container without the need for rebuilding and redeploying the container/pod. Note that this setup only works with exploded, non-WAR applications, which is the default build mode of Jib. In addition, the underlying Java application servers should also support reload or restarts.
The project’s samples section provides a few examples to get started with Jib.