With Google open source Java tools Jib container building image

Reprinted: https://blog.csdn.net/u012562943/article/details/80995373

I. Introduction

The vessel appears to let Java developers ever closer to "write once, run anywhere" workflow than ever before, but to be a container of a Java application is not easy: you have to write Dockerfile, as root run Docker daemon waiting to build complete, the final image will be pushed to the remote registry. But not all Java developers are experts in container, as before, only we need to build a JAR package days are over? To address this challenge, Google open source a Java container tool Jib, with this tool, Java developers can use their familiar tools to build Java container. Jib is a quick and simple container mirror build tool, which handles all of the steps to package the application to the container the desired mirror. It does not require you to write or install Dockerfile Docker, and can be integrated directly into Maven, just want to add to the build plug-in, Java applications can be containerized immediately.

Two, Docker build process:

Three, Jib build process:

Four, Jib how to develop a better
Jib advantage of the hierarchical mechanism Docker mirror, integrate and build system, and build Java container image optimization in the following ways
simple --Jib use Java development, and as part of Maven run. You do not need to write Dockerfile or run Docker daemon, even without creating a large JAR contains all depend on the package. Because of the close integration with Java Jib build process, so it has access to all the information required to package applications. During the subsequent containers constructed, it will automatically select any variant constructs had Java.
Quick --Jib image layering and use the registry to cache for fast, incremental build. It reads the configuration of your build, your application will be organized into different layers (dependencies, resource, class), and only re-build and push layer is changed. When the project for rapid iteration, Jib layer of talk about change occurs (rather than the entire application) pushed to build the registry to save valuable time.
Reproducible --Jib mirror support container declarative constructs according to construct the metadata Maven, therefore, remain unchanged as long as the input, can create the same image through the repeated configuration.
5, how to use the Jib container of your application
Jib can be used as a Maven plugin, and only need to make minimal configuration. Simply add the plug-in to build and configure the definition of the target image can be. If you want to push the mirror private registry to configure the required keys to Jib. The easiest way is to use the voucher assistant docker-credential-gcr like. Jib also provides a number of other rules for constructing a mirror to Docker daemon.
In Maven used Jib:
<plugin>
  <the groupId> com.google.cloud.tools </ the groupId>
  <the artifactId> JIB-Maven-plugin </ the artifactId>
  <version>0.9.0</version>
  <configuration>
    <to>
      <image>gcr.io/my-project/image-built-with-jib</image>
    </to>
  </configuration>
</plugin>
# Builds to a container image registry.
$ mvn compile jib:build
# Builds to a Docker daemon.
$ mvn compile jib:dockerBuild
Jib项目地址:github.com/GoogleContainerTools/jib

Original Address: https://www.cnblogs.com/zxf330301/p/9294932.html

Reprinted: https://blog.csdn.net/u012562943/article/details/80995373

I. Introduction

The vessel appears to let Java developers ever closer to "write once, run anywhere" workflow than ever before, but to be a container of a Java application is not easy: you have to write Dockerfile, as root run Docker daemon waiting to build complete, the final image will be pushed to the remote registry. But not all Java developers are experts in container, as before, only we need to build a JAR package days are over? To address this challenge, Google open source a Java container tool Jib, with this tool, Java developers can use their familiar tools to build Java container. Jib is a quick and simple container mirror build tool, which handles all of the steps to package the application to the container the desired mirror. It does not require you to write or install Dockerfile Docker, and can be integrated directly into Maven, just want to add to the build plug-in, Java applications can be containerized immediately.

Two, Docker build process:

Three, Jib build process:

Four, Jib how to develop a better
Jib advantage of the hierarchical mechanism Docker mirror, integrate and build system, and build Java container image optimization in the following ways
simple --Jib use Java development, and as part of Maven run. You do not need to write Dockerfile or run Docker daemon, even without creating a large JAR contains all depend on the package. Because of the close integration with Java Jib build process, so it has access to all the information required to package applications. During the subsequent containers constructed, it will automatically select any variant constructs had Java.
Quick --Jib image layering and use the registry to cache for fast, incremental build. It reads the configuration of your build, your application will be organized into different layers (dependencies, resource, class), and only re-build and push layer is changed. When the project for rapid iteration, Jib layer of talk about change occurs (rather than the entire application) pushed to build the registry to save valuable time.
Reproducible --Jib mirror support container declarative constructs according to construct the metadata Maven, therefore, remain unchanged as long as the input, can create the same image through the repeated configuration.
5, how to use the Jib container of your application
Jib can be used as a Maven plugin, and only need to make minimal configuration. Simply add the plug-in to build and configure the definition of the target image can be. If you want to push the mirror private registry to configure the required keys to Jib. The easiest way is to use the voucher assistant docker-credential-gcr like. Jib also provides a number of other rules for constructing a mirror to Docker daemon.
In Maven used Jib:
<plugin>
  <the groupId> com.google.cloud.tools </ the groupId>
  <the artifactId> JIB-Maven-plugin </ the artifactId>
  <version>0.9.0</version>
  <configuration>
    <to>
      <image>gcr.io/my-project/image-built-with-jib</image>
    </to>
  </configuration>
</plugin>
# Builds to a container image registry.
$ mvn compile jib:build
# Builds to a Docker daemon.
$ mvn compile jib:dockerBuild
Jib项目地址:github.com/GoogleContainerTools/jib

Guess you like

Origin www.cnblogs.com/jpfss/p/10930439.html