diff --git a/docker/cinder/cinder-api/Dockerfile.j2 b/docker/cinder/cinder-api/Dockerfile.j2 index 2b2414b8df..3d8d082599 100644 --- a/docker/cinder/cinder-api/Dockerfile.j2 +++ b/docker/cinder/cinder-api/Dockerfile.j2 @@ -1,25 +1,33 @@ FROM {{ namespace }}/{{ image_prefix }}cinder-base:{{ tag }} MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} + {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -RUN yum -y install \ - python-keystone \ - && yum clean all + {% set cinder_api_packages = [ + 'python-keystone' + ] %} + {% elif base_distro in ['ubuntu'] %} -RUN apt-get -y install --no-install-recommends \ - cinder-api \ - && apt-get clean + {% set cinder_api_packages = [ + 'cinder-api' + ] %} {% endif %} + +RUN {{ macros.install_packages(cinder_api_packages | customizable("packages")) }} + {% endif %} COPY extend_start.sh /usr/local/bin/kolla_cinder_extend_start RUN chmod 755 /usr/local/bin/kolla_cinder_extend_start +{% block cinder_api_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }} USER cinder diff --git a/docker/cinder/cinder-backup/Dockerfile.j2 b/docker/cinder/cinder-backup/Dockerfile.j2 index 13d707d877..e187693f6a 100644 --- a/docker/cinder/cinder-backup/Dockerfile.j2 +++ b/docker/cinder/cinder-backup/Dockerfile.j2 @@ -1,16 +1,22 @@ FROM {{ namespace }}/{{ image_prefix }}cinder-base:{{ tag }} MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} + {% if install_type == 'binary' %} {% if base_distro in ['ubuntu'] %} -RUN apt-get -y install --no-install-recommends \ - cinder-backup \ - && apt-get clean + {% set cinder_backup_packages = [ + 'cinder-backup' + ] %} + +RUN {{ macros.install_packages(cinder_backup_packages | customizable("packages")) }} {% endif %} {% endif %} +{% block cinder_backup_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }} USER cinder diff --git a/docker/cinder/cinder-base/Dockerfile.j2 b/docker/cinder/cinder-base/Dockerfile.j2 index 50b15f675e..e6749442e3 100644 --- a/docker/cinder/cinder-base/Dockerfile.j2 +++ b/docker/cinder/cinder-base/Dockerfile.j2 @@ -1,47 +1,51 @@ FROM {{ namespace }}/{{ image_prefix }}openstack-base:{{ tag }} MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} + {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -RUN yum -y install \ - openstack-cinder \ - python-automaton \ - lvm2 \ - ceph-common \ - && yum clean all \ - && mkdir -p /etc/ceph + {% set cinder_base_packages = [ + 'openstack-cinder', + 'python-automaton', + 'lvm2', + 'ceph-common' + ] %} {% elif base_distro in ['ubuntu'] %} -RUN apt-get -y install --no-install-recommends \ - cinder-common \ - ceph-common \ - lvm2 \ - && apt-get clean \ - && mkdir -p /etc/ceph + {% set cinder_base_packages = [ + 'cinder-common', + 'ceph-common', + 'lvm2' + ] %} {% endif %} + +RUN {{ macros.install_packages(cinder_base_packages | customizable("packages")) }} + {% elif install_type == 'source' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -RUN yum -y install \ - lvm2 \ - qemu-img \ - ceph-common \ - && yum clean all + {% set cinder_base_packages = [ + 'lvm2', + 'qemu-img', + 'ceph-common' + ] %} {% elif base_distro in ['ubuntu', 'debian'] %} -RUN apt-get -y install --no-install-recommends \ - lvm2 \ - qemu-utils \ - ceph-common \ - && apt-get clean \ - && mkdir -p /etc/ceph + {% set cinder_base_packages = [ + 'lvm2', + 'qemu-utils', + 'ceph-common' + ] %} {% endif %} +RUN {{ macros.install_packages(cinder_base_packages | customizable("packages")) }} + ADD cinder-base-archive /cinder-base-source RUN ln -s cinder-base-source/* cinder \ && useradd --user-group cinder \ @@ -57,7 +61,11 @@ COPY cinder_sudoers /etc/sudoers.d/kolla_cinder_sudoers COPY extend_start.sh /usr/local/bin/kolla_extend_start RUN usermod -a -G kolla cinder \ + && mkdir -p /etc/ceph \ && chmod 750 /etc/sudoers.d \ && chmod 440 /etc/sudoers.d/kolla_cinder_sudoers \ && touch /usr/local/bin/kolla_cinder_extend_start \ && chmod 755 /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_cinder_extend_start + +{% block cinder_base_footer %}{% endblock %} +{% block footer %}{% endblock %} diff --git a/docker/cinder/cinder-rpcbind/Dockerfile.j2 b/docker/cinder/cinder-rpcbind/Dockerfile.j2 index 02085901a0..eede97c8ef 100644 --- a/docker/cinder/cinder-rpcbind/Dockerfile.j2 +++ b/docker/cinder/cinder-rpcbind/Dockerfile.j2 @@ -1,21 +1,27 @@ FROM {{ namespace }}/{{ image_prefix }}cinder-base:{{ tag }} MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} + {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -RUN yum -y install \ - nfs-utils \ - nfs-utils-lib \ - && yum clean all + {% set cinder_rpcbind_packages = [ + 'nfs-utils', + 'nfs-utils-lib' + ] %} {% elif base_distro in ['ubuntu', 'debian'] %} -RUN apt-get -y install --no-install-recommends \ - rpcbind \ - && apt-get clean + {% set cinder_rpcbind_packages = [ + 'rpcbind' + ] %} {% endif %} +RUN {{ macros.install_packages(cinder_rpcbind_packages | customizable("packages")) }} + +{% block cinder_rpcbind_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }} USER cinder diff --git a/docker/cinder/cinder-scheduler/Dockerfile.j2 b/docker/cinder/cinder-scheduler/Dockerfile.j2 index 3c8c0c6c6b..aa53456847 100644 --- a/docker/cinder/cinder-scheduler/Dockerfile.j2 +++ b/docker/cinder/cinder-scheduler/Dockerfile.j2 @@ -1,16 +1,22 @@ FROM {{ namespace }}/{{ image_prefix }}cinder-base:{{ tag }} MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} + {% if install_type == 'binary' %} {% if base_distro in ['ubuntu'] %} -RUN apt-get -y install --no-install-recommends \ - cinder-scheduler \ - && apt-get clean + {% set cinder_scheduler_packages = [ + 'cinder-scheduler' + ] %} + +RUN {{ macros.install_packages(cinder_scheduler_packages | customizable("packages")) }} {% endif %} {% endif %} +{% block cinder_scheduler_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }} USER cinder diff --git a/docker/cinder/cinder-volume/Dockerfile.j2 b/docker/cinder/cinder-volume/Dockerfile.j2 index 2fe940de33..8cb7e28b51 100644 --- a/docker/cinder/cinder-volume/Dockerfile.j2 +++ b/docker/cinder/cinder-volume/Dockerfile.j2 @@ -1,31 +1,44 @@ FROM {{ namespace }}/{{ image_prefix }}cinder-base:{{ tag }} MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} + {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -RUN yum -y install \ - scsi-target-utils \ - && yum clean all + {% set cinder_volume_packages = [ + 'scsi-target-utils' + ] %} +RUN {{ macros.install_packages(cinder_volume_packages | customizable("packages")) }} + +{% block cinder_volume_redhat_setup %} RUN sed -i '1 i include /var/lib/cinder/volumes/*' /etc/tgt/tgtd.conf +{% endblock %} {% elif base_distro in ['ubuntu', 'debian'] %} -RUN apt-get -y install --no-install-recommends \ - tgt \ - && apt-get clean + {% set cinder_volume_packages = [ + 'tgt' + ] %} +RUN {{ macros.install_packages(cinder_volume_packages | customizable("packages")) }} + +{% block cinder_volume_ubuntu_setup %} RUN sed -i '1 i include /var/lib/cinder/volumes/*' /etc/tgt/targets.conf +{% endblock %} {% endif %} + {% if install_type == 'binary' %} -{% if base_distro in ['ubuntu', 'debian'] %} + {% if base_distro in ['ubuntu', 'debian'] %} -RUN apt-get -y install --no-install-recommends \ - cinder-volume \ - && apt-get clean + {% set cinder_volume_packages = [ + 'cinder-volume' + ] %} -{% endif %} +RUN {{ macros.install_packages(cinder_volume_packages | customizable("packages")) }} + + {% endif %} {% endif %} COPY cinder_sudoers /etc/sudoers.d/cinder_sudoers @@ -35,6 +48,8 @@ RUN chmod 750 /etc/sudoers.d \ && chmod 440 /etc/sudoers.d/cinder_sudoers \ && chmod 755 /usr/local/bin/kolla_extend_start +{% block cinder_volume_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }} USER cinder