GoogleContainerTools / jib

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

Hi, I am trying to call the python script from Spring boot Java application which is containerized with Google Jib. #4185

Closed NitinSharma1991 closed 1 month ago

NitinSharma1991 commented 6 months ago

I am trying to call a python script for some business purposes which is containerized with Google Jib. I would like to know how can I copy python into the jib if it's possible , so that it will allow me to call the script from the application itself.

igouss commented 6 months ago

I copy shell file like this:

jib {
...
        extraDirectories {
            paths {
                path {
                    from = file('docker/files')
                    into = '/'
                    includes = ['entrypoint.sh']
                }
            }
            permissions = [
                    '/entrypoint.sh'     : '755',
            ]
        }
}
NitinSharma1991 commented 6 months ago

This is just to copy the script file. How about copy python executable to run python script as a process.

mpeddada1 commented 3 months ago

@NitinSharma1991 similar to what was described above, to make Python binaries available to your Java application within the container, you can use Jib's extraDirectories feature to copy them into the desired location. This Maven and Gradle doc explains how you can add arbitrary files to the jib container (the python binary can be added the same way). By default, the file will be copied onto the src/main/jib directory but the destination can be customized as instructed in the links attached.

zhumin8 commented 1 month ago

Closing as there is no followups from issue reporter. Feel free to reopen if you still have questions on this topic.