aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docker/base/Dockerfile.j214
-rw-r--r--docker/macros.j213
2 files changed, 11 insertions, 16 deletions
diff --git a/docker/base/Dockerfile.j2 b/docker/base/Dockerfile.j2
index cf1f8e437..18212f0bb 100644
--- a/docker/base/Dockerfile.j2
+++ b/docker/base/Dockerfile.j2
@@ -166,11 +166,9 @@ RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
# Enable couple required repositories for all RHEL builds
# Turn on EPEL throughout the build
RUN yum-config-manager --enable rhel-7-server-optional-rpms \
- && yum -y install \
- yum-plugin-priorities \
+ && {{ macros.install_packages( ['yum-plugin-priorities' ], chain=True, clean=False) }} \
{%- if install_type != 'binary' or install_metatype != 'rdo' %}
- && yum -y install \
- https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \
+ && {{ macros.install_packages( [ 'https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm' ], chain=True, clean=False) }} \
&& rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 \
{% endif -%}
&& yum-config-manager --enable rhel-7-server-extras-rpms \
@@ -187,10 +185,7 @@ RUN yum-config-manager --enable rhel-7-server-optional-rpms \
{% block base_oraclelinux_package_installation %}
COPY oraclelinux-extras.repo /etc/yum.repos.d/oraclelinux-extras.repo
-RUN yum -y install \
- tar \
- yum-utils \
- https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \
+RUN {{ macros.install_packages( ['tar', 'yum-utils', 'https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm' ], chain=True, clean=False) }} \
&& rpm -Uvh --nodeps \
http://mirror.centos.org/centos-7/7/extras/x86_64/Packages/centos-release-ceph-luminous-1.1-2.el7.centos.noarch.rpm \
http://mirror.centos.org/centos-7/7/extras/x86_64/Packages/centos-release-opstools-1-8.el7.noarch.rpm \
@@ -203,8 +198,7 @@ RUN yum -y install \
&& 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-config-manager --enable ol7_optional_latest ol7_addons \
- && yum -y install \
- yum-plugin-priorities \
+ && {{ macros.install_packages( ['yum-plugin-priorities' ], chain=True, clean=False) }} \
&& {{ macros.rpm_security_update(clean_package_cache) }}
{% endblock %}
diff --git a/docker/macros.j2 b/docker/macros.j2
index d27b7b238..533a14aa5 100644
--- a/docker/macros.j2
+++ b/docker/macros.j2
@@ -1,16 +1,17 @@
-{% macro install_packages(packages) -%}
+{% macro install_packages(packages, chain=False, clean=clean_package_cache) -%}
{% if packages is defined and packages|length > 0 -%}
- {% if base_package_type == 'rpm' -%}
- RUN {{ distro_package_manager }} -y install {{ packages | join(' ') }}
- {%- if clean_package_cache %} \
- && {{ distro_package_manager }} clean all && rm -rf /var/cache/{{ distro_package_manager }}{% endif %}
+ {% if not chain -%} RUN {% endif -%}
+ {%- if base_package_type == 'rpm' -%}
+ {{ distro_package_manager }} -y install {{ packages | join(' ') }}
+ {%- if clean %} \
+ && {{ distro_package_manager }} clean all && rm -rf /var/cache/{{ distro_package_manager }}{% endif -%}
{%- elif base_package_type == 'deb' -%}
{#-
debian_package_install is a utility method to build up an appropriate
set of commands to install packages in a debian-based environment that
may include URL links to a .deb package
-#}
- RUN {{ debian_package_install(packages, clean_package_cache) }}
+ {{ debian_package_install(packages, clean) }}
{%- endif %}
{%- endif %}
{%- endmacro %}