Skip to content
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

Empty folders in the /app/resources directory slow down resource file scanning #4209

Open
gubiao opened this issue Mar 7, 2024 · 0 comments

Comments

@gubiao
Copy link

gubiao commented Mar 7, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants