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

Dockerfile*.native could attempt to COPY *.so files by default #41250

Open
Karm opened this issue Jun 17, 2024 · 2 comments
Open

Dockerfile*.native could attempt to COPY *.so files by default #41250

Karm opened this issue Jun 17, 2024 · 2 comments

Comments

@Karm
Copy link
Member

Karm commented Jun 17, 2024

Description

There has been this thing with AWT extension (that enables numerous document processing extensions such as Tika, POI, or general PDF or image processing integrations) where you had to copy not only the runner executable, but also all the .so files libraries the build generated, i.e. there are more artifacts then the single native executable.

It sounds trivial, but as usual, the topic has wide spread tentacles. See these cases:

  1. ✔️ *.so files must be copied over to ./target dir Adapts AWT extension to the new dynamic .so loading [JDK 17, 19, 20] #32432
  2. ✔️ *.so files must be packaged to function.zip for AWS Lambda Packs libraries alongside executable in function.zip #35718
  3. ⏳ *.so files must be copied over from a remote container build Adds -H:+GenerateBuildArtifactsFile, copies .so from remote container #41201
  4. ⌛ *.so files must be copied over to the runtime image

As noted in an old discussion on the topic, trying to COPY an empty set of artifacts results in a container build error, both with Podman and Docker.

A way around this I have been using in awt-graphics-rest-quickstart is:

  • edit .dockerignore to add:
!target/*.so
!target/*.properties
  • edit Dockerfile.native to add a line that copies *.so files and *.properties:
# Shared objects to be dynamically loaded at runtime as needed,
COPY --chown=1001:root target/*.properties target/*.so /work/

That way, some file is always copied over, admittedly superfluously, and it is quarkus-artifact.properties. If the build produced *.so files, those are coped over too. Note that creating a micro image is slightly more demanding.

Tackling case 4.: runtime image

@gsmet suggested that our default template in Dockerfile.tpl.qute.native could be adjusted to deal with copying *.so files.

Question

I poked around it and it is not entirely clear to me how to test it, where it is actually used.
My usual workflow I know is quarkus-container-image-docker and adding -Dquarkus.native.container-build=true, -Dquarkus.container-image.build=true, but that requires user to already have src/main/docker/Dockerfile.native in the project, so no devtools/codestarts templace comes to play.

Does JIB use the template? Buildpack?

Implementation ideas

Edit template in Dockerfile.tpl.qute.native, according to what is described above.

@Karm Karm added the kind/enhancement New feature or request label Jun 17, 2024
@Karm Karm self-assigned this Jun 17, 2024
@quarkus-bot
Copy link

quarkus-bot bot commented Jun 17, 2024

/cc @geoand (jib), @zakkak (native-image)

@geoand
Copy link
Contributor

geoand commented Jun 17, 2024

Does JIB use the template?

It does not

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