From 6b6251693df4e1bc8653d1dbccc84d336856efda Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Tue, 27 Feb 2024 10:36:38 +0200 Subject: [PATCH] Set JAVA_APP_DIR env var when necessary When using Jib to build the container image (and the defaults have not been changed), JAVA_APP_DIR should be present in order to avoid situations where agent jars cannot be located. Fixes: #39022 (cherry picked from commit 05fd6ff1e812175c49ae00bfe885d16ecb07c9f7) --- .../io/quarkus/container/image/jib/deployment/JibProcessor.java | 1 + 1 file changed, 1 insertion(+) diff --git a/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibProcessor.java b/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibProcessor.java index 843f5a0480238..7eaa9bde7be69 100644 --- a/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibProcessor.java +++ b/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibProcessor.java @@ -455,6 +455,7 @@ private JibContainerBuilder createContainerBuilderFromFastJar(String baseJvmImag // which would mean AppCDS would not be taken into account at all entrypoint = List.of(RUN_JAVA_PATH); envVars.put("JAVA_APP_JAR", workDirInContainer + "/" + JarResultBuildStep.QUARKUS_RUN_JAR); + envVars.put("JAVA_APP_DIR", workDirInContainer.toString()); envVars.put("JAVA_OPTS_APPEND", String.join(" ", determineEffectiveJvmArguments(jibConfig, appCDSResult))); } else { List effectiveJvmArguments = determineEffectiveJvmArguments(jibConfig, appCDSResult);