question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

extraDirectory should maintain same project structure

See original GitHub issue

Description of the issue: Currently, when using <extraDirectories>, it dumps all files in the specific directory into the root of the docker container.

Expected behavior: Similar to while using src/main/jib/..., <extraDirectories> should just use the directory structure when copying it into the docker container.

Environment: Maven

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
TadCordlecommented, May 7, 2019

I think I might understand. Jib just takes the contents of the directory you specify and moves it to the root directory in the image, which is intended. To get the files where you need them to go, you need to setup the exact intended destination directory structure within your extra directory.

If you want your secret files to be in /.build/secrets/decrypted on your container, for example, then you would need to configure your extra directory, and have the extra directory itself contain .build/secrets/decrypted/....

E.g. configure <extraDirectories><paths>${project.basedir}/secretsDir</paths></extraDirectories> then put your secret files in <project dir>/secretsDir/.build/secrets/decrypted/... to get your files in /.build/secrets/decrypted/ on your image.

But I think I can see why you might not want to do this, if the .build directory contains other files that you don’t want to add to the container, and you only want to add those secret files, but you don’t want to add them to /. Extra layers in Jib is still an incubating feature, though, so if the current design doesn’t match your use case and you have any suggestions for how you’d like it to work, feel free to let us know.

Let me know if this does/doesn’t make sense, or if I’m misinterpreting the problem!

1reaction
bspradlingcommented, May 7, 2019

Hey @TadCordle. I have a single module Maven project and the following is the Jib plugin configuration within my pom.xml:

      <plugin>
        <groupId>com.google.cloud.tools</groupId>
        <artifactId>jib-maven-plugin</artifactId>
        <version>0.9.10</version>
        <configuration>
          <from>
            <image>anapsix/alpine-java:8_server-jre_unlimited</image>
          </from>
          <to>
            <image>my-image:built-with-jib</image>
          </to>
          <extraDirectories><paths>${project.basedir}/.build/secrets/decrypted</paths></extraDirectories>
        </configuration>
      </plugin>

I’m trying to mount some secret files from .build/secrets/decrypted but when the image is created, I can exec into the container and see the expected files in the root (/) directory.

Let me know if there is anything else that I can provide or I am doing something wrong!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to maintain same folder structure in github with git ...
I want to track my project folder and its subfolder with node modules together with git add . But it seems I can't...
Read more >
3094 – Extra directory created under ide-beta (1GHJBG2)
4. After installation, I go into '/opt/vame1.4/ide-beta' and execute './vame'. An 'opt' directory appears under 'ide-beta' containing a skeleton of the normal ...
Read more >
git - It is good practice for each project (within a directory) to be ...
So I have two questions: Is it a good idea to split each project out into its own repository? (If so, will this...
Read more >
Good Integration Practices — pytest documentation
Putting tests into an extra directory outside your actual application code might be useful if you have many functional tests or for other...
Read more >
Can someone please explain to me the rational for shoving > your ...
... (which are environment-specific and fragile), and (3) you are not maintaining an extra directory structure which could diverge by accident.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found