-
Notifications
You must be signed in to change notification settings - Fork 40.8k
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
Recommend that DevTools is excluded when building something other than a fat jar such as a Docker image #15382
Comments
This looks like a packaging or dependency scope issue. If DevTools is on the classpath, it will always be active to some degree (the restarter is disabled in tests). To fix this, DevTools should be excluded from the image that Jib builds in the same way that it is excluded from the fat jars that Boot's Maven and Gradle plugins build. The behaviour of Jib's Maven plugin doesn't feel like something that's in Boot's control to me. Perhaps you can configure Jib not to include the dependency, either by changing DevTools dependency's scope in your pom or by configuring Jib's Maven plugin to exclude it? |
Jib doesn't let you exclude dependencies, but it probably should (I found this issue but they don't seem to want to fix it). The best I came up with is switching off the restarter:
I agree that it's not a Spring Boot problem per se, but it is a problem that our users will encounter, so it's probably a good idea to at least document the issue and any workarounds we find. |
We could add something here. |
The way I do this is with maven profiles. A profile that includes devtools, and active by default. And a docker profile that defines jib parameters. Locally I have devtools, and a jenkins build uses -Pdocker to disable devtools and build images to my registry.
|
So for gradle we should use to prevent
But how to prevent https://github.com/GoogleContainerTools/jib/tree/master/jib-gradle-plugin to include devtools while creating the docker image? |
@kguelzau That's really a question for the maintainers of Jib's Gradle plugin. |
I don't think they are willing to change that (see GoogleContainerTools/jib#1254).
Seems to work, but seems to be "hacky"... |
This isn't really an issue with Jib per se, or rather it is potentially an issue with any container that is built without the jar file (so the same applies to containers built by a buildpack for cloud foundry for instance). Jib is an easy way to re-create the problem.
E.g. in Petclinic:
The text was updated successfully, but these errors were encountered: