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

Also copy .so files when doing a native-image build #329

Merged
merged 1 commit into from
Jul 15, 2024
Merged

Also copy .so files when doing a native-image build #329

merged 1 commit into from
Jul 15, 2024

Conversation

dmikusa
Copy link
Contributor

@dmikusa dmikusa commented Jul 14, 2024

Summary

Some applications, when native-image runs, will also generate shared libraries which are required to run the application. These libraries get put next to the generated binary file. This change modifies the buildpack to copy these shared libraries after it copies the binary to the application directory.

In a nutshell, native-image runs, writes binary and shared libs to a cached layer. We then copy files from the cached layer to the application directory (i.e. /workspace) which results in them being available in the application image.

Resolves #308

Use Cases

Support native-image builds that require additional JNI libraries, like when using AWT.

Checklist

  • I have viewed, signed, and submitted the Contributor License Agreement.
  • I have linked issue(s) that this PR should close using keywords or the Github UI (See docs)
  • I have added an integration test, if necessary.
  • I have reviewed the styleguide for guidance on my code quality.
  • I'm happy with the commit history on this PR (I have rebased/squashed as needed).

Some applications, when native-image runs, will also generate shared libraries which are required to run the application. These libraries get put next to the generated binary file. This change modifies the buildpack to copy these shared libraries after it copies the binary to the application directory.

In a nutshell, native-image runs, writes binary and shared libs to a cached layer. We then copy files from the cached layer to the application directory (i.e. /workspace) which results in them being available in the application image.

Signed-off-by: Daniel Mikusa <dan@mikusa.com>
@dmikusa dmikusa added semver:patch A change requiring a patch version bump type:bug A general bug labels Jul 14, 2024
@dmikusa dmikusa requested a review from a team as a code owner July 14, 2024 22:49
Copy link
Member

@anthonydahanne anthonydahanne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pretty straightforward.
you have examples of native images relying on .so files somewhere? in the samples?
oh ok #308

@dmikusa dmikusa merged commit 30ed23c into main Jul 15, 2024
7 checks passed
@dmikusa dmikusa deleted the gh_308 branch July 15, 2024 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver:patch A change requiring a patch version bump type:bug A general bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Certain Native image artifacts are not copied to run image
2 participants