-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to separate 3rd party dependency layer from in-house jar dependencies ? #1962
Comments
I wrote a quick-and-dirty implementation (maven only) which works well for my usecase: With For example, I can force all dependencies starting with
I am ready to polish my pull request if you would consider accepting it. Thanks |
Hi @mzagar That's a very interesting use case that makes us think we should have a way to support. For a long time, we've had a lot discussions around layering various sorts of dependencies, and looks like we still need to think about this more.
I think you should avoid this. There used to have a very small limit (of 42) as to how many layers you can have, which I believe has been mostly lifted on modern kernels, but I think many still may face another limit (of 127, for example): docker/docs#8230 |
#1724 does exactly what you want. |
Should this be closed? |
Hi @OneCricketeer, for me this is still an issue so I vote not close it. Unfortunately #1724 does not solve my problem. Here's a structure of infobip-hello maven project I am building: After After diving into docker image built with jib 2.1.0 here's the content of jib layers : 1. dependencyJars layer
2. snapshotDependencyJars layer3. projectDependencyJars
4. app resources layer5. app class layer6. jib extra directoryMy challenge is that in dependencyJars layer (1) in-house (infobip-*) dependencies are present alongside 3rd party dependencies and I would like to avoid it - what I would like to happen is:
If I am doing something wrong in using jib and I can accomplish this easily already please point me how to do it. If not, I still am in favor of my suggestion to introduce this 'separate layer' where user could control with a regex which dependencies should be stored in this layer - sounds like a generic enough solution which can help to optimize docker images for such usecases as I described, but is not mandatory to be used. Any suggestion how to go about this is greatly appreciated - I am ready to invest my time and create a PR for whichever approach would help me solve this problem. Thanks, |
@mzagar we're not going to close this. For now, I don't see an immediate workaround in your situation to have this level of fine-grained control. As we are getting numerous feature requests to Jib (many of which are often very specific to certain use-cases, don't align well with Jib's model or intentions, are too complex to support without polluting our codebase or configuration with special code, etc.), we decided to introduce an extension framework to Jib (#2401) rather than trying to implement all of them one way or another. With the extension system, anyone will be able to extend and/or modify Jib's behavior relatively easily and have a fine-grained control over most of the aspects of image building. I think that will cover most of such issues and FRs, including this one. (FTR: #2450 for the list asking for the feature of fine-grained layer control.) |
sounds great, thanks! any eta or a task I could follow the progress of the extension framework? |
We are working on it, but I think it's going to take a while. We aim to complete this at least in the second quarter. Tracking: #2401 |
@mzagar @hendrikhalkow @OneCricketeer The Jib Extension Framework is now available with the latest Jib versions. You can easily extend and tailor the Jib plugins behavior to your liking. We've written a general-purpose layer-filter extension that enables fine-grained layer control, including deleting files and moving files into new layers. The extension will cover your use-case to create a separate layer for in-hours jar dependencies (or any new layer for any files). For general information about using and writing extensions, take a look at the Jib Extensions repo. |
@chanseokoh just wanted to say the layer-filter extension works just the way we need, thanks! |
Hi,
Is there a way to tell jib to put some jar dependencies into an 'extra' layer or to put all dependency jars into spearate layers: 1 jar - 1 layer ?
Here's my use case:
If I could somehow tell jib to put those 'fast changing' in-company jar dependencies into a layer separate from 3rd party jars then I would get much less overhead when pushing/pulling images in case some of in-company jar dependency version changes because 3rd party jars layer would not be touched and instead of pulling 70MB image change I would pull only a 5MB layer (with all in-company jars inside, those changed aswell as those not changed).
In my mind this layer would function the same way 'SNAPSHOT' layer does, only I could specify which jar releases go to this layer, something like:
Coming back to my original question - instead of this complicated extra layer jar selection maybe it would make sense to have an option to put every dependency jar to a separate layer - that way whichever jar changes, only those layers/jars would get pulled.
The text was updated successfully, but these errors were encountered: