diff --git a/docker/swift/swift-account/Dockerfile.j2 b/docker/swift/swift-account/Dockerfile.j2 index 72a609c24a..6fd31431f6 100644 --- a/docker/swift/swift-account/Dockerfile.j2 +++ b/docker/swift/swift-account/Dockerfile.j2 @@ -1,22 +1,21 @@ FROM {{ namespace }}/{{ image_prefix }}swift-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-swift-account \ - && yum clean all - + {% set swift_acount_packages = ['openstack-swift-account'] %} {% elif base_distro in ['ubuntu'] %} - -RUN apt-get -y install --no-install-recommends \ - swift-account \ - && apt-get clean - + {% set swift_acount_packages = ['swift-account'] %} {% endif %} + +RUN {{ macros.install_packages(swift_acount_packages | customizable("packages")) }} + {% endif %} +{% block swift_account_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }} USER swift diff --git a/docker/swift/swift-base/Dockerfile.j2 b/docker/swift/swift-base/Dockerfile.j2 index 2e05ac29ff..15bf9ee494 100644 --- a/docker/swift/swift-base/Dockerfile.j2 +++ b/docker/swift/swift-base/Dockerfile.j2 @@ -1,35 +1,25 @@ 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-swift \ - && yum clean all - + {% set swift_base_packages = ['openstack-swift'] %} {% elif base_distro in ['ubuntu'] %} - -RUN apt-get -y install --no-install-recommends \ - swift \ - && apt-get clean - + {% set swift_base_packages = ['swift'] %} {% endif %} + +RUN {{ macros.install_packages(swift_base_packages | customizable("packages")) }} + {% elif install_type == 'source' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} - -RUN yum -y install \ - liberasurecode-devel \ - && yum clean all - + {% set swift_base_packages = ['liberasurecode-devel'] %} {% elif base_distro in ['ubuntu', 'debian'] %} - -RUN apt-get -y install --no-install-recommends \ - liberasurecode-dev \ - && apt-get clean - + {% set swift_base_packages = ['liberasurecode-dev'] %} {% endif %} +RUN {{ macros.install_packages(swift_base_packages | customizable("packages")) }} ADD swift-base-archive /swift-base-source RUN ln -s swift-base-source/* swift \ && useradd --user-group swift \ @@ -56,3 +46,6 @@ COPY build-swift-ring.py /usr/local/bin/kolla_build_swift_ring RUN mkdir -p /opt/swift RUN usermod -a -G kolla swift + +{% block swift_base_footer %}{% endblock %} +{% block footer %}{% endblock %} diff --git a/docker/swift/swift-container/Dockerfile.j2 b/docker/swift/swift-container/Dockerfile.j2 index 1e56d6a015..cbce0c2bdb 100644 --- a/docker/swift/swift-container/Dockerfile.j2 +++ b/docker/swift/swift-container/Dockerfile.j2 @@ -1,22 +1,21 @@ FROM {{ namespace }}/{{ image_prefix }}swift-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-swift-container \ - && yum clean all - + {% set swift_container_packages = ['openstack-swift-container'] %} {% elif base_distro in ['ubuntu'] %} - -RUN apt-get -y install --no-install-recommends \ - swift-container \ - && apt-get clean - + {% set swift_container_packages = ['swift-container'] %} {% endif %} + +RUN {{ macros.install_packages(swift_container_packages | customizable("packages")) }} + {% endif %} +{% block swift_container_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }} USER swift diff --git a/docker/swift/swift-object/Dockerfile.j2 b/docker/swift/swift-object/Dockerfile.j2 index 0c88d18ce7..e169f4de0c 100644 --- a/docker/swift/swift-object/Dockerfile.j2 +++ b/docker/swift/swift-object/Dockerfile.j2 @@ -1,22 +1,21 @@ FROM {{ namespace }}/{{ image_prefix }}swift-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-swift-object \ - && yum clean all - + {% set swift_object_packages = ['openstack-swift-object'] %} {% elif base_distro in ['ubuntu'] %} - -RUN apt-get -y install --no-install-recommends \ - swift-object \ - && apt-get clean - + {% set swift_object_packages = ['swift-object'] %} {% endif %} + +RUN {{ macros.install_packages(swift_object_packages | customizable("packages")) }} + {% endif %} +{% block swift_object_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }} USER swift diff --git a/docker/swift/swift-proxy-server/Dockerfile.j2 b/docker/swift/swift-proxy-server/Dockerfile.j2 index 22e53b8450..6ba07b9026 100644 --- a/docker/swift/swift-proxy-server/Dockerfile.j2 +++ b/docker/swift/swift-proxy-server/Dockerfile.j2 @@ -1,22 +1,21 @@ FROM {{ namespace }}/{{ image_prefix }}swift-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-swift-proxy \ - && yum clean all - + {% set swift_proxy_server_packages = ['openstack-swift-proxy'] %} {% elif base_distro in ['ubuntu'] %} - -RUN apt-get -y install --no-install-recommends \ - swift-proxy \ - && apt-get clean - + {% set swift_proxy_server_packages = ['swift-proxy'] %} {% endif %} + +RUN {{ macros.install_packages(swift_proxy_server_packages | customizable("packages")) }} + {% endif %} +{% block swift_proxy_server_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }} USER swift diff --git a/docker/swift/swift-rsyncd/Dockerfile.j2 b/docker/swift/swift-rsyncd/Dockerfile.j2 index 4cb8b7fce1..74864edefe 100644 --- a/docker/swift/swift-rsyncd/Dockerfile.j2 +++ b/docker/swift/swift-rsyncd/Dockerfile.j2 @@ -1,23 +1,20 @@ FROM {{ namespace }}/{{ image_prefix }}swift-base:{{ tag }} MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} + {% if base_distro in ['fedora', 'centos', 'oraclelinux', 'rhel'] %} - -RUN yum -y install \ - rsync \ - && yum clean all - + {% set swift_rsyncd_packages = ['rsync'] %} {% elif base_distro in ['ubuntu', 'debian'] %} - -RUN apt-get -y install --no-install-recommends \ - rsync \ - && apt-get clean - + {% set swift_rsyncd_packages = ['rsync'] %} {% endif %} +RUN {{ macros.install_packages(swift_rsyncd_packages | customizable("packages")) }} COPY extend_start.sh /usr/local/bin/kolla_extend_start RUN chmod 755 /usr/local/bin/kolla_extend_start +{% block swift_rsyncd_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }} USER swift