How can I use the Python baseline image?

Where to find the image?

Since Guilin, the Integration team builds python baseline image for the projects.

docker pull nexus3.onap.org:10001/onap/integration-python:latest
docker pull nexus3.onap.org:10001/onap/integration-python:7.0.0 (7 = Guilin)

How is it built?

This baseline image is built based on the Docker file that you can find in https://git.onap.org/integration/docker/onap-python/tree/

The image is based on python:3.8.2-alpine3.11, an official python image matching SECCOM recoomendation for python and alpine.

It is built through a jjb associated with the integration/onap-python repository hosted in ONAP ci-management repositorty.


How to use it in your project?

In the Docker file, 2 ONBUILD directives have been added.

Due to these ONBUILD directive, each project MUST provide a requirements.txt file before building an image derived from this baseline image.



Without this requirements.txt file, the docker built will fail.

The pip install -r requirements.txt will be executed on the build of your own image.

An example of Dockerfile consuming this base line image could be:



FROM nexus3.onap.org:10001/onap/integration-python:7.0.0
RUN echo "Add your specifc docker needs here."

FROM nexus3.onap.org:10001/onap/integration-python:7.0.0
RUN echo "Add your specifc docker needs here."


Your requirements.txt must be at the root of your Dockerfile and include all your required python libraries needed on the runtime of your docker.
Ideally you can indicate these dependencies as follows, you may indicate the constraints on the version and/or the associated license.

The list must be explicit (no '.')



# The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. pbr!=2.1.0 # Apache-2.0 PyYAML # MIT requests!=2.20.0 # Apache-2.0 robotframework>=3.0 scp cloudify-rest-client mock!=4.0.0,!=4.0.1 # BSD PrettyTable<0.8 # BSD six # MIT paramiko # LGPLv2.1+ Jinja2 # BSD License (3 clause) xtesting os-client-config # Apache-2.0 shade # Apache-2.0 ruamel.yaml.jinja2 # MIT tempest # Apache-2.0 rally rally-openstack





# The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. pbr!=2.1.0 # Apache-2.0 PyYAML # MIT requests!=2.20.0 # Apache-2.0 robotframework>=3.0 scp cloudify-rest-client mock!=4.0.0,!=4.0.1 # BSD PrettyTable<0.8 # BSD six # MIT paramiko # LGPLv2.1+ Jinja2 # BSD License (3 clause) xtesting os-client-config # Apache-2.0 shade # Apache-2.0 ruamel.yaml.jinja2 # MIT tempest # Apache-2.0 rally rally-openstack





References


official pip user guide: https://pip.pypa.io/en/stable/user_guide/