I'm new to python. I have a maven project which uses the org.jolokia maven-docker-plugin to create a docker image that consumes a python library called Talon.
Currently the container uses a script which executes (along with other pre-requisites):
pip install talon==1.2.6
/usr/local/lib/python2.7/dist-packages/talon/xxx.py
pip install /maven/talon.tar.gz
python /maven/talon/setup.py install
The way to do this is to get your python project into the image and run install
on the setup.py. This method assumes your image already has the python interpreter and the relevant dependencies installed for your project to run.
Copy your python project code into a folder in your maven project i.e. one called input
.
Use fileSets in the assembly of the image to assemble the python source code into the image. <directory>
should point to the input folder containing your python source code:
<assembly>
<mode>tar</mode>
<inline>
<fileSets>
<fileSet>
<directory>C:/.../input</directory>
<outputDirectory>/output</outputDirectory>
<includes>
<include>**/*</include>
</includes>
</fileSet>
</fileSets>
</inline>
</assembly>
Then you want a script to run python setup.py install
from the output directory (/maven/output/mypythonproject).
I.e. use a runCmd:
<runCmds>
<run>
cd /maven/output/mypythonproject \
python setup.py install
</run>
</runCmds>
This installs the python module and puts egg file in the /usr/local/lib/python27/dist-packages
folder, which will be found by your python interpreter.