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

Add support for static compilation with native-image #650

Open
cforce opened this issue Jan 11, 2023 · 2 comments
Open

Add support for static compilation with native-image #650

cforce opened this issue Jan 11, 2023 · 2 comments
Labels
type:enhancement A general enhancement

Comments

@cforce
Copy link

cforce commented Jan 11, 2023

To compile full static native-images the MUSL CC is neded on the linux os which runs the native-image compile
Provide support with liberica-openjdk-alpine-musl as packet buildpack ( https://registry.hub.docker.com/r/bellsoft/liberica-openjdk-alpine-musl)

<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
  <configuration>
    <image>
      <buildpacks>
        <buildpack>gcr.io/paketo-buildpacks/bellsoft-liberica:${bellsoft-liberica.version}</buildpack>
        <buildpack>gcr.io/paketo-buildpacks/java-native-image</buildpack>
      </buildpacks>
    </configuration>
</plugin>

Also see #507

@dmikusa
Copy link
Contributor

dmikusa commented Jan 11, 2023

This would require a new buildpack to install the MUSL build tools. I'm OK leaving this open as a placeholder though.

@dmikusa dmikusa added the type:enhancement A general enhancement label Jan 11, 2023
@dmikusa dmikusa transferred this issue from paketo-buildpacks/bellsoft-liberica Jul 7, 2023
@dmikusa dmikusa changed the title Allow to use MUSL with liberica in spring-boot-maven-plugin Add support for static compilation with native-image Jul 7, 2023
@dmikusa dmikusa transferred this issue from paketo-buildpacks/java Jul 7, 2023
@dmikusa
Copy link
Contributor

dmikusa commented Jul 7, 2023

Moving this and changing this as a request to enable support for static compilation with native image.

Off the top of my head, this will require adding the MUSLC build tools. One way would be to create a buildpack that contributes to the MUSLC build tools. Another would be to use an extension and have them installed with the native package manager. Aside from that, we might want to add a flag to the native-image buildpack that makes setting the required arguments easier. Like BP_NATIVE_IMAGE_STATIC=true|false.

See #507 (comment) for more background.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants