GoogleContainerTools / jib

🏗 Build container images for your Java applications.
Apache License 2.0
13.58k stars 1.43k forks source link

extraDirectories directory that doesn't exist locally: in command-line(-Djib.extraDirectories.paths) #4184

Open cebrailinanc opened 7 months ago

cebrailinanc commented 7 months ago

Environment:

Description of the issue: I get an error when I try to build with the command line. Parameter -Djib.extraDirectories.paths parse incorrectly. This code only receiving as from. Value of into always is '/'

Command:

./gradlew jibDockerBuild --image=poc-jib:latest -Djib.from.image=openjdk:21-slim -Djib.extraDirectories.paths='extra, /var/temp'

discussed here

Expected behavior: should have copied the files in the extra to /var/temp

Steps to reproduce:

  1. I created a sample project (https://github.com/cebrailinanc/jib-demo)

Log output:

  • What went wrong: Execution failed for task ':jibDockerBuild'. extraDirectories.paths contain "from" directory that doesn't exist locally: /var/temp
artemptushkin commented 6 months ago

Hey I want to support this issue, given this comment I think we should be able to set to from the CLI too, currently it's not possible, e.g.

What I tried (all below not working), any option I'd expect to work to set both from and to from the CLI parameter:

# expect /app/config is in the image

./gradlew jibDockerBuild  -Djib.extraDirectories.paths='/Users/artemptushkin/foo/config,/app/config'

./gradlew jibDockerBuild  -Djib.extraDirectories.paths.path.from='/Users/artemptushkin/foo/config' -Djib.extraDirectories.paths.path.to='/app/config'

./gradlew jibDockerBuild -Djib.extraDirectories.paths=['/Users/artemptushkin/gitlab/IptiQ/dx/kotlin-app-example/config','/app/config']

What works is just from:

./gradlew jibDockerBuild  -Djib.extraDirectories.paths='/Users/artemptushkin/foo/config'

All the files and directories from foo/config will be in the root of the image. We can use it still make more directories in from so we emulate the path in the target image, e.g.

from:


If it's should be another issue - let me know, I will create one