Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.googlecontainertools:jib:3.4.4-maven'
}
dependencies {
implementation("com.github.googlecontainertools:jib:3.4.4-maven")
}
<dependency>
<groupId>com.github.googlecontainertools</groupId>
<artifactId>jib</artifactId>
<version>3.4.4-maven</version>
</dependency>
libraryDependencies += "com.github.googlecontainertools" % "jib" % "3.4.4-maven"
:dependencies [[com.github.googlecontainertools/jib "3.4.4-maven"]]
| βοΈ Jib User Survey | | :----- | | What do you like best about Jib? What needs to be improved? Please tell us by taking a one-minute survey. Your responses will help us understand Jib usage and allow us to serve our customers (you!) better. |
Jib builds optimized Docker and OCI images for your Java applications without a Docker daemon - and without deep mastery of Docker best-practices. It is available as plugins for Maven and Gradle and as a Java library.
Jib works well with Google Cloud Build. For details, see how to use Jib on Google Cloud Build.
For more information, check out the official blog post or watch this talk (slides).
Fast - Deploy your changes fast. Jib separates your application into multiple layers, splitting dependencies from classes. Now you donβt have to wait for Docker to rebuild your entire Java application - just deploy the layers that changed.
Reproducible - Rebuilding your container image with the same contents always generates the same image. Never trigger an unnecessary update again.
Daemonless - Reduce your CLI dependencies. Build your Docker image from within Maven or Gradle and push to any registry of your choice. No more writing Dockerfiles and calling docker build/push.
Maven - See the jib-maven-plugin Quickstart.
Gradle - See the jib-gradle-plugin Quickstart.
Jib Core - See the Jib Core Quickstart.
Jib CLI - See the Jib CLI doc.
The examples directory includes the following examples (and more).
Whereas traditionally a Java application is built as a single image layer with the application JAR, Jib's build strategy separates the Java application into multiple layers for more granular incremental builds. When you change your code, only your changes are rebuilt, not your entire application. These layers, by default, are layered on top of an OpenJDK base image, but you can also configure a custom base image. For more information, check out the official blog post or watch this talk (slides).
See also rules_docker for a similar existing container image build tool for the Bazel build system.
A lot of questions are already answered!
For usage questions, please ask them on Stack Overflow.
See the Privacy page.
We welcome contributions! Here's how you can contribute:
Contribute:
Join in on discussion issues
<!-- * Read the [style guide] -->Make sure to follow the Code of Conduct when contributing so we can foster an open and welcoming community.
This is not an officially supported Google product.