diff --git a/docker/base/Dockerfile.j2 b/docker/base/Dockerfile.j2 index 22a6278f4c..cd5baf12e5 100644 --- a/docker/base/Dockerfile.j2 +++ b/docker/base/Dockerfile.j2 @@ -3,6 +3,7 @@ MAINTAINER {{ maintainer }} LABEL kolla_version="{{ kolla_version }}" +{% import "macros.j2" as macros with context %} {% block base_header %}{% endblock %} {{ include_header }} @@ -32,24 +33,28 @@ RUN if [ $(awk '{match($0, /[0-9]+/,version)}END{print version[0]}' /etc/system- #### BEGIN REPO ENABLEMENT # Turns on Elasticsearch repos -COPY elasticsearch.yum.repo /etc/yum.repos.d/elasticsearch.repo +{% set base_yum_repo_files = [ + 'elasticsearch.repo', + 'kibana.yum.repo', + 'MariaDB.repo', + 'influxdb.repo' + ] %} +{% for repo_file in base_yum_repo_files | customizable('yum_repo_files') %} +COPY {{ repo_file }} /etc/yum.repos.d/{{ repo_file }} +{% endfor %} -# Turns on Kibana repo -COPY kibana.yum.repo /etc/yum.repos.d/kibana.yum.repo - -# Turns on MariaDB repos throughout the RPM build -COPY mariadb.yum.repo /etc/yum.repos.d/MariaDB.repo - -# Turns on InfluxDB repos throughout the RPM build -COPY influxdb.yum.repo /etc/yum.repos.d/influxdb.repo - -RUN yum -y install \ - http://repo.percona.com/release/7/RPMS/x86_64/percona-release-0.1-3.noarch.rpm \ - && rpm --import http://yum.mariadb.org/RPM-GPG-KEY-MariaDB \ - && rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-Percona \ - && rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch \ - && rpm --import https://repos.influxdata.com/influxdb.key +{% set base_yum_url_packages = [ + 'http://repo.percona.com/release/7/RPMS/x86_64/percona-release-0.1-3.noarch.rpm' +] %} +{{ macros.install_packages(base_yum_url_packages | customizable("yum_url_packages")) }} +{% set base_yum_repo_keys = [ + 'http://yum.mariadb.org/RPM-GPG-KEY-MariaDB', + '/etc/pki/rpm-gpg/RPM-GPG-KEY-Percona ', + 'https://packages.elastic.co/GPG-KEY-elasticsearch', + 'https://repos.influxdata.com/influxdb.key' +] %} +RUN true {% for key in base_yum_repo_keys | customizable('yum_repo_keys') %}&& rpm --import {{ key }} {% endfor %} {% if install_metatype in ['rdo', 'mixed'] %} {% for cmd in rpm_setup %} @@ -69,16 +74,24 @@ RUN yum-config-manager --enable rhel-7-server-rpms \ {% if base_distro == 'centos' %} -RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 \ - && yum -y install \ - epel-release \ - yum-plugin-priorities \ - centos-release-ceph-hammer \ - centos-release-qemu-ev \ - && rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 \ - && rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Storage \ - && rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Virtualization \ - && yum clean all +RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 + +{% set base_centos_yup_repo_keys = [ + '/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7', + '/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Storage', + '/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Virtualization' +] %} + +{% set base_centos_yum_repo_packages = [ + 'epel-release ', + 'yum-plugin-priorities', + 'centos-release-ceph-hammer', + 'centos-release-qemu-ev' +] %} + +{{ macros.install_packages(base_centos_yum_repo_packages | customizable("yum_centos_repo_packages")) }} +RUN true \ +{% for key in base_centos_yum_repo_keys | customizable('yum_centos_repo_keys') %} && rpm --import {{ key }}{% endfor %} && yum clean all {% endif %} {# Endif for base_distro centos #} @@ -149,32 +162,32 @@ RUN yum -y update \ COPY versionlock.list /etc/yum/pluginconf.d/ {% if install_type == 'binary' %} - +{% set base_centos_binary_packages = [ + 'sudo', + 'which', + 'python', + 'lvm2', + 'scsi-target-utils', + 'iscsi-initiator-utils' +] %} # Install base packages -RUN yum -y install \ - sudo \ - which \ - python \ - lvm2 \ - scsi-target-utils \ - iscsi-initiator-utils \ - && yum clean all - +{{ macros.install_packages( base_centos_binary_packages | customizable("centos_binary_packages")) }} {% endif %} {# Endif for install_type binary #} {% if install_type == 'source' %} +{% set base_centos_source_packages = [ + 'curl', + 'sudo', + 'tar', + 'which', + 'lvm2', + 'scsi-target-utils', + 'iscsi-initiator-utils' +] %} # Update packages -RUN yum -y install \ - curl \ - sudo \ - tar \ - which \ - lvm2 \ - scsi-target-utils \ - iscsi-initiator-utils \ - && yum clean all +{{ macros.install_packages( base_centos_source_packages | customizable("centos_source_packages")) }} {% endif %} {# endif for install type is source for RPM based distros #} @@ -235,13 +248,13 @@ COPY apt_preferences.{{ base_distro }} /etc/apt/preferences {% block base_ubuntu_package_installation %} RUN true \ - {% for key in base_apt_keys %} + {% for key in base_apt_keys | customizable('apt_keys') %} && apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 {{ key }} \ {% endfor %} && apt-get update \ && apt-get -y upgrade \ && apt-get -y dist-upgrade \ - && apt-get -y install --no-install-recommends {% for package in base_apt_packages %}{{ package }} {% endfor %} \ + && apt-get -y install --no-install-recommends {% for package in base_apt_packages | customizable('apt_packages') %}{{ package }} {% endfor %} \ && apt-get clean {% endblock %} @@ -264,4 +277,5 @@ RUN touch /usr/local/bin/kolla_extend_start \ && groupadd kolla \ && rm -f /tmp/kolla_bashrc +{% block base_footer %}{% endblock %} CMD ["kolla_start"] diff --git a/docker/base/mariadb.yum.repo b/docker/base/MariaDB.repo similarity index 100% rename from docker/base/mariadb.yum.repo rename to docker/base/MariaDB.repo diff --git a/docker/base/elasticsearch.yum.repo b/docker/base/elasticsearch.repo similarity index 100% rename from docker/base/elasticsearch.yum.repo rename to docker/base/elasticsearch.repo diff --git a/docker/base/influxdb.yum.repo b/docker/base/influxdb.repo similarity index 100% rename from docker/base/influxdb.yum.repo rename to docker/base/influxdb.repo