GoogleContainerTools / jib

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

Jib CLI proxy usage not documented #4231

Open scrat98 opened 7 months ago

scrat98 commented 7 months ago

There is no documentation that we can configure JVM options (You can also use JAVA_OPTS and JIB_OPTS to pass JVM options) for jib cli. That's needed when we want to configure proxy that will be used by jib-core under the hood. But as soon there is a plan to make jib cli native executable it will be better to add proxy options as a cli parameters.

Configure http proxy to use by jib cli:

  JIB_OPTS: >-
    -Dhttp.proxyHost=$PROXY_HOST
    -Dhttp.proxyPort=$PROXY_PORT
    -Dhttps.proxyHost=$PROXY_HOST
    -Dhttps.proxyPort=$PROXY_PORT
    -Dhttp.nonProxyHosts=$NO_PROXY
mpeddada1 commented 1 month ago

Thanks for bringing this up! We have some documentation to set jvm-flags through the --jvm-flags option in the jib CLI jar command and to customize environment variables if using the jib cli build command (https://github.com/GoogleContainerTools/jib/blob/6df635ee51bc466c961cdeea23d84e84e87ba4b0/jib-cli/README.md#fully-annotated-build-file-jibyaml) which can be used to set JAVA_TOOL_OPTIONS. However, there may be an opportunity to clarify this a bit more in our FAQ entry

scrat98 commented 1 month ago

@mpeddada1 My use case is following: I have restricted environment where is access to the public Internet available only via proxy. I'm using "jib build" command and base image have to be downloaded from the dockerhub central. I cannot use environment variables in jib.yaml for such scenario. Therefore I need to open script file and realize that I can pass jvm parameters using JIB_OPTS (inside script You can also use JAVA_OPTS and JIB_OPTS to pass JVM options to this script.). And moreover, before that I have to know that inside jib-core it's using jvm networking properties