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

Buildpack looks for manifest even when binary is provided #688

Open
lanthoor opened this issue Jun 5, 2024 · 1 comment
Open

Buildpack looks for manifest even when binary is provided #688

lanthoor opened this issue Jun 5, 2024 · 1 comment

Comments

@lanthoor
Copy link

lanthoor commented Jun 5, 2024

Hi there,

I am building an image using a pre-built binary (jar file). The file is specified using the --path flag of pack CLI. The heroku jvm buildpack ignores it completely and looks for a manifest file (pom.xml/etc.). This results in no buildpack group passing detection and my image build fails. PFA the command and the logs.

$ pack build my/image:latest --path ./path/to/app.jar --env 'BP_JVM_VERSION=22.*' --env BP_JVM_TYPE=JRE --builder heroku/builder:24 --trust-builder --platform linux/arm64

===> ANALYZING
Restoring data for SBOM from previous image
===> DETECTING
======== Output: heroku/[email protected] ========
No Python project files found (such as requirements.txt).
======== Results ========
fail: heroku/[email protected]
skip: heroku/[email protected]
======== Results ========
pass: heroku/[email protected]
skip: heroku/[email protected]
pass: heroku/[email protected]
pass: heroku/[email protected]
skip: heroku/[email protected]
Resolving plan... (try #1)
fail: heroku/[email protected] provides unused node
Resolving plan... (try #2)
skip: heroku/[email protected] provides unused node
skip: heroku/[email protected] provides unused jdk
fail: heroku/[email protected] provides unused ruby
======== Results ========
pass: heroku/[email protected]
fail: heroku/[email protected]
fail: heroku/[email protected]
skip: heroku/[email protected]
======== Results ========
pass: heroku/[email protected]
fail: heroku/[email protected]
fail: heroku/[email protected]
skip: heroku/[email protected]
======== Results ========
pass: heroku/[email protected]
skip: heroku/[email protected]
fail: heroku/[email protected]
skip: heroku/[email protected]
======== Results ========
pass: heroku/[email protected]
skip: heroku/[email protected]
skip: heroku/[email protected]
fail: heroku/[email protected]
skip: heroku/[email protected]
======== Results ========
pass: heroku/[email protected]
skip: heroku/[email protected]
Resolving plan... (try #1)
fail: heroku/[email protected] provides unused node
Resolving plan... (try #2)
fail: heroku/[email protected] provides unused node
======== Results ========
pass: heroku/[email protected]
fail: heroku/[email protected]
skip: heroku/[email protected]
======== Results ========
pass: heroku/[email protected]
fail: heroku/[email protected]
skip: heroku/[email protected]
======== Results ========
pass: heroku/[email protected]
fail: heroku/[email protected]
skip: heroku/[email protected]
======== Results ========
pass: heroku/[email protected]
skip: heroku/[email protected]
Resolving plan... (try #1)
fail: heroku/[email protected] provides unused go
======== Output: heroku/[email protected] ========
No PHP project files found.
======== Results ========
fail: heroku/[email protected]
skip: heroku/[email protected]
ERROR: No buildpack groups passed detection.
ERROR: Please check that you are running against the correct path.
ERROR: failed to detect: no buildpacks participating
ERROR: failed to build: executing lifecycle: failed with status code: 20

Could you adjust the buildpack detection logic so that it doesn't look for a manifest file when the --path flag is specified to point to a jar/war?

@Malax
Copy link
Member

Malax commented Jun 5, 2024

Hi @lanthoor!

Thanks for letting us know about your use-case, appreciated! You're correct, this isn't supported out of the box currently.

The workaround for the current state of the builder would be adding a system.properties file next to your jar file with the following contents: java.runtime.version=22 and passing the directory with the jar and the system.properties to pack via --path. In addition, you'd need to specify the heroku/jvm buildpack explicitly.

In addition, this buildpack would not create a process for your single jar file automatically. You could use a Procfile (next to your jar and system.properties files) to configure the default process to run:

web: java -jar myjar.jar

This would be the command you're looking for:

pack build my/image:latest --path ./dir --builder heroku/builder:24 --trust-builder --platform linux/arm64 --buildpack heroku/jvm --buildpack heroku/procfile

I understand that this is much more elaborate than pointing pack to a jar file and have it just work. I'll leave this issue open and will update it over time as the situation improves for the use-case.

Let me know if the above works for you or if you encountered other obstacles, happy to help!

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

No branches or pull requests

2 participants