-
Notifications
You must be signed in to change notification settings - Fork 644
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
Add support for setting dockerFile and dockerFileDir via maven properties #438
Conversation
Refactored a bit the validation handling since it would be otherwise called to often.
Thanks a lot ! I tuned it a bit, but otherwise everythings fine. Just out of curiosity: Why do you prefer property based configuration over XML style ? |
Great! We tend to put all our project configuration in properties so it gives us just one place to look rather than multiple locations. I wouldn't say one is better than the other, but it allows greater consistency for how we work. For the same reason we prefer the external Dockerfile to make it more consistent with how we build our other docker images. |
@rhuss, I had a quick look at the integration branch and I noticed the following commit after merging this PR: The change to src/main/java/io/fabric8/maven/docker/AbstractDockerMojo.java on line 247 removes the following:
This means The unit test you added explicitly calls init:
Maybe I am missing something, or there a better place to trigger the init methods to run? I would have added the Hope that makes sense. |
The critical point is this line which already does the resolution of the images before the validation. Hope this makes sense. |
@rhuss, thanks for the response. However, I believe there is still a problem. Each time Something like this: private List<ImageConfiguration> resolveImages() {
if (resolvedImages != null) {
return resolvedImages;
}
List<ImageConfiguration> ret = new ArrayList<>();
if (images != null) {
for (ImageConfiguration image : images) {
ret.addAll(imageConfigResolver.resolve(image, project.getProperties()));
}
verifyImageNames(ret);
}
return resolvedImages = ret;
} I have created a new PR #445 |
Moved out the resolving, customization, initializaition and validation in an external ConfigurationResolver utility class. resolved images are now cached, so that the initialization is kept. Todo: Unit tests.
Thanks, you are right, the resolved images should be cached. I refactored the initial configuration handling quite a bit and pushed it to branch |
Thanks, the |
After upgrading to v0.15.1, I see the
docker.assembly.dockerFileDir
has been deprecated. It would be nice to retain support for configuring via properties.In addition, when the
BuildImageConfiguration
is resolved from properties, theinitAndValidate()
method needs to be called in order for thedockerFileFile
anddockerFileMode
to be set (docker.assembly.dockerFileDir
no longer works).