diff --git a/docker/crane/Dockerfile.j2 b/docker/crane/Dockerfile.j2 index aea3f301f4..dfb8fe9eb7 100644 --- a/docker/crane/Dockerfile.j2 +++ b/docker/crane/Dockerfile.j2 @@ -45,9 +45,7 @@ RUN echo 'crane not yet available for {{ base_distro }}' && /bin/false {% endif %} {% block crane_source_install_python_pip %} -RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \ - && python get-pip.py \ - && rm get-pip.py +{{ macros.get_pip() }} {% endblock %} ADD crane-archive /crane-source diff --git a/docker/helm-repository/Dockerfile.j2 b/docker/helm-repository/Dockerfile.j2 index dc20229b81..3734e28560 100644 --- a/docker/helm-repository/Dockerfile.j2 +++ b/docker/helm-repository/Dockerfile.j2 @@ -35,9 +35,7 @@ ENV helm_version=2.3.0 \ {{ macros.install_packages(helm_repo_packages | customizable("packages")) }} {% block helm_repository_source_install_python_pip %} -RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \ - && python get-pip.py \ - && rm get-pip.py +{{ macros.get_pip() }} {% endblock %} {% set helm_repository_pip_packages = [ diff --git a/docker/kolla-toolbox/Dockerfile.j2 b/docker/kolla-toolbox/Dockerfile.j2 index 768ebd2dd3..ca616074b7 100644 --- a/docker/kolla-toolbox/Dockerfile.j2 +++ b/docker/kolla-toolbox/Dockerfile.j2 @@ -47,9 +47,7 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build {{ macros.install_packages(kolla_toolbox_packages | customizable("packages")) }} {% block kolla_toolbox_source_install_python_pip %} -RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \ - && python get-pip.py \ - && rm get-pip.py +{{ macros.get_pip() }} {% endblock %} {% set kolla_toolbox_pip_virtualenv_packages = [ diff --git a/docker/macros.j2 b/docker/macros.j2 index 5386dca750..aee933e7b2 100644 --- a/docker/macros.j2 +++ b/docker/macros.j2 @@ -21,6 +21,12 @@ {% endif %} {%- endmacro %} +{% macro get_pip() %} +RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \ + && python get-pip.py \ + && rm get-pip.py +{% endmacro %} + {% macro install_pip(packages, constraints = true, pip_version = pip) %} {%- if packages is sequence and packages|length > 0 -%} {%- if not pip_version -%} diff --git a/docker/openstack-base/Dockerfile.j2 b/docker/openstack-base/Dockerfile.j2 index 8073494c9a..ffc26dffb7 100644 --- a/docker/openstack-base/Dockerfile.j2 +++ b/docker/openstack-base/Dockerfile.j2 @@ -185,9 +185,7 @@ ENV DEBIAN_FRONTEND noninteractive {{ macros.install_packages(openstack_base_packages | customizable("packages")) }} {% block source_install_python_pip %} -RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \ - && python get-pip.py \ - && rm get-pip.py +{{ macros.get_pip() }} {% endblock %} {% set openstack_base_pip_packages = [ diff --git a/releasenotes/notes/get_pip-macro-906a78462b216049.yaml b/releasenotes/notes/get_pip-macro-906a78462b216049.yaml new file mode 100644 index 0000000000..f4ed0d92bd --- /dev/null +++ b/releasenotes/notes/get_pip-macro-906a78462b216049.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + New macro: 'get_pip' allows to bootstrap 'pip' in image.