Comments (1)
Ultimately, I achieved the desired result with the help of the following changes in the settings of the jib-maven-plugin plugin:
- add dependency to the plugin jib-layer-filter-extension-maven - this is for managing layers when creating an image:
<dependencies>
<dependency>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-layer-filter-extension-maven</artifactId>
<version>0.3.0</version>
</dependency>
</dependencies>
- Add extraDirectories so that fat jar formed by spring boot is included to the image:
<extraDirectories>
<paths>
<path>
<from>target</from>
<into>/app/classpath</into>
<includes>*.jar</includes>
</path>
</paths>
</extraDirectories>
- Then in pluginExtensions we delete the old jar that created jib and delete libs, because all libs are in our fat jar from spring:
<pluginExtensions>
<pluginExtension>
<implementation>com.google.cloud.tools.jib.maven.extension.layerfilter.JibLayerFilterExtension</implementation>
<configuration implementation="com.google.cloud.tools.jib.maven.extension.layerfilter.Configuration">
<filters>
<filter>
<glob>/app/classpath/*.original.jar</glob>
</filter>
<filter>
<glob>/app/libs/*.jar</glob>
</filter>
</filters>
</configuration>
</pluginExtension>
</pluginExtensions>
- And we add the correct entry point of our jar for spring (if we have spring boot >= 3.2, then the class will be different org.springframework.boot.loader.launch.JarLauncher):
<entrypoint>java,-cp,@/app/jib-classpath-file,org.springframework.boot.loader.JarLauncher</entrypoint>
As a result, fat jar will simply lie in /app/classpath folder.
If you do everything through jib-cli, then instead of fat jar there will be an unpacked jar in the /app folder.
from jib.
Related Issues (20)
- Timestamped Snapshots are not well respected with jib
- manifest unknown | If this is a bug, please file an issue at
- v0.27.1-core not building amd64 images on M1+ macs HOT 1
- Jib gradle plugin and Java modules? HOT 4
- Failed to execute goal com.google.cloud.tools:jib-maven-plugin:3.2.1:dockerBuild HOT 1
- Docker not found when using Java 21 HOT 2
- The configured platforms don't match the Docker Engine's OS and architecture HOT 4
- Google Container Registry Migration to Google Artifact Registry
- Unrecognized field "artifactType" in ManifestDescriptorTemplate HOT 1
- stuck at 40,0% complete HOT 1
- Duplicate put requests to registry trigger errors HOT 3
- Improve error message when labels map contains null values HOT 2
- JIB Maven Container Labels with Properties from Parent POM HOT 1
- Blob Upload Invalid When Pushing to Local Distribution Registry HOT 3
- Searching for mainClass even if entrypoint is specified HOT 4
- Pushing to GitHub fails with BLOB_UPLOAD_UNKNOWN HOT 2
- Publish jib-cli on Maven central
- Support building image from jib.yaml in Maven plugin
- Usage of Spring boot Gradle configuration name
- Can I use Jib Plugin Without Skaffold?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jib.