GoogleContainerTools / GoogleContainerTools/jib
appRoot property is not actually defaulted to /app
- Dominant language
- Java
- Stars
- 14.5k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
**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](https://github.com/GoogleContainerTools/jib/blob/master/jib-gradle-plugin/README.md#extended-usage) 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:
```groovy
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`:
```groovy
jib {
container {
appRoot = "/app"
}
extraDirectories {
paths {
path {
from = "$project.rootDir/frontend/build"
into = "${jib.container.appRoot}/resources"
}
}
}
from {
image = "eclipse-temurin:17-jre"
}
}
```
Contributor guide
Assessment
This issue has not been assessed yet.