appRoot property is not actually defaulted to /app
Environment:
-
Jib version:
3.2.1 - Build tool: Gradle
- OS: Mac OS Monterey 12.4, M1
Description of the issue:
The property reference jib.container.appRoot returns root container directory instead of default /app
It works properly when you have container section explicitly defined (see below) but it's not convenient as the documentation says it should be /app by default
Expected behavior:
jib.container.appRoot always has the default value as it's documented
Steps to reproduce:
The next configuration:
jib {
extraDirectories {
paths {
path {
from = "$project.rootDir/frontend/build"
into = "${jib.container.appRoot}/resources"
}
}
}
from {
image = "eclipse-temurin:17-jre"
}
}
Brings that inside the image files from $project.rootDir/frontend/build will be in . / root container directory and not the /app where other files are located
Workaround
Define container container before extraDirectories:
jib {
container {
appRoot = "/app"
}
extraDirectories {
paths {
path {
from = "$project.rootDir/frontend/build"
into = "${jib.container.appRoot}/resources"
}
}
}
from {
image = "eclipse-temurin:17-jre"
}
}
You are right that this is a bit confusing in the documentation. What is meant by "default" is that if jib.container.appRoot is missing, the rest of Jib functionality will use /app by default. Jib never meant to set a default value for the gradle property.
This is working as intended, but if you have ideas on how to make this distinction clearer, we'd be happy to accept a documentation contribution.
@elefeint I see, thanks. But why can't we just set /app as default?
No reason; we'd accept a contribution to that effect.
@elefeint I'd contribute then, I'll open a PR later