kolla/docker/gnocchi/gnocchi-base/Dockerfile.j2
Marcin Juszkiewicz ffe08baa72 docker: do not install pip again in images
We install pip in base image so why repeat?

Change-Id: Id903880b121d87d75b7b14084b0961b9ce99deba
2021-01-25 16:43:18 +01:00

108 lines
3.2 KiB
Django/Jinja

FROM {{ namespace }}/{{ image_prefix }}openstack-base:{{ tag }}
{% block labels %}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% endblock %}
{% block gnocchi_base_header %}{% endblock %}
{% import "macros.j2" as macros with context %}
{{ macros.configure_user(name='gnocchi') }}
{{ macros.enable_extra_repos(['ceph']) }}
{% if install_type == 'binary' %}
{# NOTE(mgoddard): EPEL required for python3-boto3 package on CentOS 8 #}
{{ macros.enable_extra_repos(['epel']) }}
{% if base_package_type == 'rpm' %}
{% set gnocchi_base_packages = [
'gnocchi-common',
'python3-boto3',
'python3-rados',
] %}
{{ macros.install_packages(gnocchi_base_packages | customizable("packages")) }}
{% elif base_package_type == 'deb' %}
{% set gnocchi_base_packages = [
'build-essential',
'gnocchi-common',
'librados-dev',
'python3-boto3',
'python3-dev',
'python3-rados',
'python3-setuptools',
'python3-wheel'
] %}
{% set gnocchi_base_pip_packages = [
'cradox'
] %}
{{ macros.install_packages(gnocchi_base_packages | customizable("packages")) }}
RUN {{ macros.install_pip(gnocchi_base_pip_packages | customizable("pip_packages"), constraints=false) }}
{% endif %}
{% elif install_type == 'source' %}
{% if base_package_type == 'rpm' %}
{% set gnocchi_base_packages = [
'librados2-devel',
] %}
# on x86-64 pip grabs precompiled numpy/scipy - on aarch64/ppc64le
# it needs to be built
{% if base_arch != 'x86_64' %}
{% set gnocchi_base_packages = gnocchi_base_packages + [
'blas-devel',
'lapack-devel'
] %}
{% endif %}
{{ macros.install_packages(gnocchi_base_packages | customizable("packages")) }}
RUN mkdir -p /var/www/cgi-bin/gnocchi
{% elif base_package_type == 'deb' %}
{% set gnocchi_base_packages = [
'librados-dev',
] %}
# on x86-64 pip grabs precompiled numpy/scipy - on aarch64/ppc64le
# it needs to be built
{% if base_arch != 'x86_64' %}
{% set gnocchi_base_packages = gnocchi_base_packages + [
'libblas-dev',
'liblapack-dev'
] %}
{% endif %}
{{ macros.install_packages(gnocchi_base_packages | customizable("packages")) }}
{% endif %}
ADD gnocchi-base-archive /gnocchi-base-source
{% set gnocchi_base_pip_packages = [
'gnocchiclient',
'/gnocchi[keystone,mysql,file,ceph,s3]'
] %}
RUN ln -s gnocchi-base-source/* gnocchi \
&& {{ macros.install_pip(gnocchi_base_pip_packages | customizable("pip_packages")) }} \
&& mkdir -p /etc/gnocchi \
&& chown -R gnocchi: /etc/gnocchi
{% endif %}
COPY extend_start.sh /usr/local/bin/kolla_extend_start
COPY gnocchi_sudoers /etc/sudoers.d/kolla_gnocchi_sudoers
RUN chmod 750 /etc/sudoers.d \
&& chmod 640 /etc/sudoers.d/kolla_gnocchi_sudoers \
&& touch /usr/local/bin/kolla_gnocchi_extend_start \
&& chmod 755 /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_gnocchi_extend_start
{% block gnocchi_base_footer %}{% endblock %}