quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.82k stars 2.69k forks source link

extensions (quarkus-container-image-buildpack) : Not able to run container image built using BuildPacks extension #40591

Open rohanKanojia opened 6 months ago

rohanKanojia commented 6 months ago

Describe the bug

I was trying out Quarkus BuildPacks extension for investigation related to https://github.com/eclipse-jkube/jkube/issues/2460

When I try to build image using buildpacks extension, I'm able to built the image but I'm not able to run the image generated using this builder image. I get this error when I run the image:

docker run rokumar/quarkus-buildpacks-builder-image-reproducer:1.0.0-SNAPSHOT
ERROR: failed to launch: determine start command: when there is no default process a command is required

I noticed that extension uses paketobuildpacks/builder:base as default builder image. I tried changing the builder image with this property quarkus.buildpack.jvm-builder-image and these values but none of them worked out :

Is there something that I might be missing? Is there any official community recommended BuildPack builder image for Quarkus? I found https://github.com/quarkusio/quarkus-buildpacks but it looks like WIP effort.

Expected behavior

Image built using BuildPacks build extension should be runnable via docker.

Actual behavior

Image Built using buildpacks is not running as expected. Is it okay to use paketobuildpacks/builder:base as default builder image ? It doesn't seem to be producing correct image.

How to Reproduce?

Clone this reproducer project : https://github.com/rohankanojia-forks/quarkus-buildpacks-builder-image-reproducer

  1. In presence of docker daemon, run gradle build -Dquarkus.container-image.build=true
  2. After image build process has finished, try running the generated image using docker run

Output of uname -a or ver

Linux fedora 6.6.13-200.fc39.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Jan 20 18:03:28 UTC 2024 x86_64 GNU/Linux

Output of java -version

java version "17.0.3.1" 2022-04-22 LTS Java(TM) SE Runtime Environment (build 17.0.3.1+2-LTS-6) Java HotSpot(TM) 64-Bit Server VM (build 17.0.3.1+2-LTS-6, mixed mode, sharing)

Quarkus version or git rev

3.10.0

Build tool (ie. output of mvnw --version or gradlew --version)

Gradle 8.6

Additional information

No response

geoand commented 6 months ago

cc @BarDweller

BarDweller commented 6 months ago

The recommended builder will eventually be paketocommunity/builder-ubi-base but note that will not work with the quarkus container image support today, as builder-ubi-base requires a platform implementation with support for image extensions (buildpacks platform spec 0.10 or greater), and the container image support doesn't have that (it only implements platform spec 0.7)

I'm working on the changes to update the platform level, but they are not in quarkus yet.

Until then, the default Paketo builder paketobuildpacks/builder:base should work fine, as long as the project is configured to create an uber jar ( https://quarkus.io/guides/gradle-tooling#building-uber-jars ). The default quarkus jar layout isn't recognised by Paketo as an executable application.

gcr.io/paketo-buildpacks/quarkus:0.2.2 isn't a builder image at all, but an OCI packaged buildpack, an intermediate artifact created by Paketo when assembling other builder images. It contains the Paketo quarkus buildpack, which spots quarkus projects and sets flags so that maven can generate a layout usable by the final container image.

codejive/buildpacks-quarkus-builder:jvm is an even older very experimental effort to create a quarkus builder image, however it only supports maven, so will not work for your gradle project.