Cleanup RUN commands in base Dockerfile

This will merge several RUN statements into one RUN statement to reduce
the number of the layers of the base Docker image.

TrivialFix

Change-Id: I69b00b2e7fa7717923f0fe364c5be9b38a2dbb90
This commit is contained in:
Christian Berendt 2016-06-25 16:59:01 +02:00
parent b6e51e9531
commit 727173f4be

View File

@ -12,8 +12,8 @@ ENV KOLLA_INSTALL_METATYPE {{ install_metatype }}
#### Customize PS1 to be used with bash shell
COPY kolla_bashrc /tmp/
RUN cat /tmp/kolla_bashrc >> /etc/skel/.bashrc
RUN cat /tmp/kolla_bashrc >> /root/.bashrc
RUN cat /tmp/kolla_bashrc >> /etc/skel/.bashrc \
&& cat /tmp/kolla_bashrc >> /root/.bashrc
# PS1 var when used /bin/sh shell
ENV PS1="$(tput bold)($(printenv KOLLA_SERVICE_NAME))$(tput sgr0)[$(id -un)@$(hostname -s) $(pwd)]$ "
@ -26,10 +26,9 @@ ENV PS1="$(tput bold)($(printenv KOLLA_SERVICE_NAME))$(tput sgr0)[$(id -un)@$(ho
{% if base_distro in ['fedora', 'centos', 'oraclelinux', 'rhel'] %}
RUN if [ $(awk '{match($0, /[0-9]+/,version)}END{print version[0]}' /etc/system-release) != "{{ supported_distro_release }}" ]; then \
echo "Only supported {{ supported_distro_release }} release on {{ base_distro }}"; false; fi
# Customize PS1 bash shell
RUN cat /tmp/kolla_bashrc >> /etc/bashrc
echo "Only supported {{ supported_distro_release }} release on {{ base_distro }}"; false; \
fi \
&& cat /tmp/kolla_bashrc >> /etc/bashrc
#### BEGIN REPO ENABLEMENT
# Turns on Elasticsearch repos
@ -42,9 +41,8 @@ COPY kibana.yum.repo /etc/yum.repos.d/kibana.yum.repo
COPY mariadb.yum.repo /etc/yum.repos.d/MariaDB.repo
RUN yum -y install \
http://repo.percona.com/release/7/RPMS/x86_64/percona-release-0.1-3.noarch.rpm
RUN rpm --import http://yum.mariadb.org/RPM-GPG-KEY-MariaDB \
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
@ -104,8 +102,6 @@ RUN yum -y install \
tar \
yum-utils \
http://mirror.centos.org/centos-7/7/extras/x86_64/Packages/epel-release-7-5.noarch.rpm \
&& yum clean all \
# TODO(pbourke): replace with mirror.centos.org once openstack-mitaka-1-3 is promoted to stable
&& rpm -Uvh --nodeps \
http://buildlogs.centos.org/centos/7/cloud/x86_64/openstack-mitaka/centos-release-openstack-mitaka-1-3.el7.noarch.rpm \
http://mirror.centos.org/centos-7/7/extras/x86_64/Packages/centos-release-ceph-hammer-1.0-5.el7.centos.noarch.rpm \
@ -115,11 +111,10 @@ RUN yum -y install \
&& sed -i 's/\$releasever/7/g' /etc/yum.repos.d/CentOS-*.repo \
&& 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
RUN yum-config-manager --enable ol7_optional_latest ol7_addons
RUN yum -y install \
yum-plugin-priorities \
&& 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 \
&& yum clean all
{% endif %}
@ -144,11 +139,8 @@ RUN yum -y install \
if base_distro in ['fedora', 'centos', 'oraclelinux', 'rhel'] #}
RUN yum -y update \
&& yum clean all
# Pin package versions
RUN yum -y install \
yum-plugin-versionlock \
&& yum -y install \
yum-plugin-versionlock \
&& yum clean all
COPY versionlock.list /etc/yum/pluginconf.d/
@ -255,8 +247,7 @@ COPY curlrc /root/.curlrc
RUN touch /usr/local/bin/kolla_extend_start \
&& chmod 755 /usr/local/bin/kolla_start /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_set_configs \
&& chmod 440 /etc/sudoers \
&& groupadd kolla
RUN rm -f /tmp/kolla_bashrc
&& groupadd kolla \
&& rm -f /tmp/kolla_bashrc
CMD ["kolla_start"]