[ 
https://issues.apache.org/jira/browse/FINERACT-1196?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17211966#comment-17211966
 ] 

Michael Vorburger commented on FINERACT-1196:
---------------------------------------------

[~aleks] I'm somewhat reluctant to adopt JIB (which I'm familiar with). The 
real reason, for me, is that a project like Apache Fineract should, IMHO, 
always strike a balance of "increasing the diversity in the zoo of libraries 
and tools new contributors have to understand to be able to effectively 
contribute" VS what value whatever latest and greatest cool new library and 
tool brings. While JIB may be "neat", I think we should carefully look at how 
much "better" it would be than the currently "simple" solution we have in 
place, which is fairly easy to understand to anyone (hopefully).

If you strongly feel like the container build time is a major issue, then it 
would be fairly trivial to address that without JIB but by building like it 
(presumably) does - you could make a Dockerfile which, instead of re-building 
Fineract in-container, just ADDs the JAR built outside into it. Few lines - 
done. But the disadvantage of that is that you then need a properly set up 
"outside" environment with at least the correct Java version available. To 
build the current container e.g. for Docker Hub or inside 
https://www.fineract.dev, with the "isolated" build env in-container, is just 
the simplest and easiest.

To get "get independent of CLI tools (and the Docker daemon)" is both a pro and 
a con. You then have to make e.g. JIB-based builds on Docker Hub or inside 
https://www.fineract.dev push to the appropriate repository - with credentials. 
I'm sure it's all doable and don't doubt JIB supports such use cases - but it 
adds new complexity.. is it "worth" it? Really?

> and we could get rid off the separate Dockerfile

But, instead, would have to figure out how to do something like e.g. the thing 
we currently do to add an additional JDBC driver, or potentially some plugin 
support system we may want to support in the future, with JIB config instead of 
in a widely understood de facto standard Dockerfile. 

> could reference just the Docker image in docker-compose.yml (instead of using 
> it as yet another build file). 

That is a completely separate issue? We could switch {{docker-compose.yml}} 
today to use the container image from Docker Hub. The drawback would be that if 
you make local changes, they do not show up anymore. 
https://github.com/apache/fineract/#instructions-to-run-using-docker-and-docker-compose
 speaks to this with _The docker-compose.yml will build the fineract container 
from the source based on the Dockerfile. You could change that to use the 
pre-built container image instead of having to re-build it._ This aspect 
doesn't have much to with HOW we actually build the container - agreed?

> JIB will create a layered Docker image which should help reducing the size of 
> the image.

Let's look at real data about this? ;) Using e.g. 
https://microbadger.com/images/apache/fineract (still processing), or 
https://github.com/wagoodman/dive, we can see that we have 8 layers today. The 
first 5 are from {{gcr.io/distroless/java:11}} from 
https://github.com/GoogleContainerTools/distroless/tree/master/java, which we 
chose to use. AFAIK, JIB actually also uses the same - so that would be the 
same? You can contribute to that project to reduce those layers... :P The 
remaining 3 are from the three {{COPY}} in our Dockerfile. If you feel strongly 
about that, I bet it's possible to combine those into 1. Which, most likely, 
would make it more compact that JIB ever could. (It has a different approach, 
and actually adds MORE layers - to make it easy to rebuild fast, for 
development - which perhaps isn't a core problem for us today?)

Hope you don't take this as too much push back or discouragement - I'm just 
openly sharing my view on pros/cons.

> Use Google JIB Gradle plugin to build Docker images
> ---------------------------------------------------
>
>                 Key: FINERACT-1196
>                 URL: https://issues.apache.org/jira/browse/FINERACT-1196
>             Project: Apache Fineract
>          Issue Type: Improvement
>          Components: Build
>    Affects Versions: 1.4.0
>            Reporter: Aleksandar Vidakovic
>            Assignee: Aleksandar Vidakovic
>            Priority: Major
>             Fix For: 1.5.0
>
>
> Please see here for more information: 
> [https://github.com/GoogleContainerTools/jib]
> The goal here would be to reduce build time (by a lot; no more Gradle build 
> inside a Docker container) and getting independent of CLI tools (and the 
> Docker daemon); and we could get rid off the separate Dockerfile, could 
> reference just the Docker image in docker-compose.yml (instead of using it as 
> yet another build file). 
> There are some nice bonuses using this plugin: JIB will create a layered 
> Docker image which should help reducing the size of the image.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to