Empty folders in the /app/resources directory slow down resource file scanning
Environment:
- Jib version: 3.4.1
- Build tool: maven
- OS: macOS Monterey
Description of the issue: There are a large number of empty folders in the /app/resources directory in the container. It seems that all java packages have corresponding folders in the /resources directory, regardless of whether they contain resource files.
Expected behavior: If the java package does not contain resource files, do not create corresponding empty folders in the /app/resources directory in the container. Or provide an includeEmptyDirs configuration parameter like maven resource plugin.
Steps to reproduce:
$ git clone https://github.com/GoogleContainerTools/jib.git
$ cd jib/examples/helloworld
Delete the following lines in pom.xml
<configuration>
<to>
<image>gcr.io/REPLACE-WITH-YOUR-GCP-PROJECT/image-built-with-jib</image>
</to>
</configuration>
$ mvn compile jib:dockerBuild
$ docker run --entrypoint /bin/bash --interactive --tty helloworld:1
# ls -alh /app/resources/example/
total 8.0K
drwxr-xr-x 2 root root 4.0K Jan 1 1970 .
drwxr-xr-x 3 root root 4.0K Jan 1 1970 ..
As you can see now, every java package that does not contain resource files has an empty folder in the /app/resources directory.
There are a lot of java packages in my current project. If there are a lot of empty folders in the /app/resources directory in the container, resource file search will become slow. For example, use Spring to scan the Hibernate mapping files: classpath*:/**/*.hbm .xml.
Additional Information: I also tried Jib Layer-Filter Extension, but it only provides glob-based file filter and cannot filter empty folders.
It would be great if we could filter out the files. There are many files in the /app/resources directory that have already been moved to the /app/classes directory. Keeping these files in the /app/resources directory would result in a much larger image.