I have a gradle project I'd like to build using jib
. The project contains subprojects arranged like so:
root
|
|build.gradle.kts
|settings.gradle.kts
|web/
|build.gradle.kts
|src/
|main/
|java....(etc)
|resources/
|config.yaml
Note that the :web subproject contains a config.yaml
in its resources.
I have my jib building a docker image in the root build.gradle with the appropriate entry point but I'm unsure how to get the :web
subproject's resources included in the image.
My jib
task in the root build.gradle
is as follows:
tasks {
jib {
configurations {
container {
mainClass = applicationMainClassName
args = listOf("server", "$appRoot/resources/config.yaml")
ports = listOf("8080")
jvmFlags = listOf("-server", "-Djava.awt.headless=true", "-XX:+UseG1GC", "-XX:MaxGCPauseMillis=100", "-XX:+UseStringDeduplication")
}
}
}
}
I've tried using both $appRoot/config.yaml
as well as $appRoot/resources/config.yaml
in the args for the container with no luck.
The error after building the image and trying to run it is as follows:
> docker run my_app
java.io.FileNotFoundException: File /resources/config.yaml not found
at io.dropwizard.configuration.FileConfigurationSourceProvider.open(FileConfigurationSourceProvider.java:18)
at io.dropwizard.configuration.SubstitutingSourceProvider.open(SubstitutingSourceProvider.java:37)
at io.dropwizard.configuration.BaseConfigurationFactory.build(BaseConfigurationFactory.java:80)
at io.dropwizard.cli.ConfiguredCommand.parseConfiguration(ConfiguredCommand.java:126)
at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:74)
at io.dropwizard.cli.Cli.run(Cli.java:78)
at io.dropwizard.Application.run(Application.java:93)
at my.web.HelloWorldApplication.main(HelloWorldApplication.java:17)