From d7e7fb48f5f50c8fedc7228a3f4c13f324064274 Mon Sep 17 00:00:00 2001
From: Raghavendra Talur <rtalur@redhat.com>
Date: Thu, 1 Mar 2018 12:29:53 +0530
Subject: fix bug when multiple shell commands are specified in RUN

If RUN is followed by two commands only the return value of second
determines whether RUN was successful or not. This may lead to cases
where docker build succeeds even when it should not.

For example
RUN /bin/false; /bin/true

would be considered a success.

Important thing to consider is that all yum/dnf commands should perform
clean in the same RUN operation if we wish to keep the container image
size small. Running clean in a second RUN operation leads to bigger
image size contrary to expectation because each operation leads to a
layer in the image.

With the above two points considered, I have replaced ";" with "&&"
where necessary and split a single RUN operation to two or many
operations in other places.

Signed-off-by: Raghavendra Talur <rtalur@redhat.com>
---
 .../CentOS/docker-gluster-s3/Dockerfile            | 28 +++++++++++-----------
 1 file changed, 14 insertions(+), 14 deletions(-)

(limited to 'gluster-s3object/CentOS')

diff --git a/gluster-s3object/CentOS/docker-gluster-s3/Dockerfile b/gluster-s3object/CentOS/docker-gluster-s3/Dockerfile
index 9c857f4..e477912 100644
--- a/gluster-s3object/CentOS/docker-gluster-s3/Dockerfile
+++ b/gluster-s3object/CentOS/docker-gluster-s3/Dockerfile
@@ -27,13 +27,13 @@ RUN yum -v --setopt=tsflags=nodocs -y update && \
         openstack-swift openstack-swift-{proxy,account,container,object,plugin-swift3} \
         git memcached python-prettytable python-setuptools && \
     yum -y install systemd && \
-        (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
-        rm -f /lib/systemd/system/multi-user.target.wants/*;\
-        rm -f /etc/systemd/system/*.wants/*;\
-        rm -f /lib/systemd/system/local-fs.target.wants/*; \
-        rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
-        rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
-        rm -f /lib/systemd/system/basic.target.wants/*;\
+        (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done) && \
+        rm -f /lib/systemd/system/multi-user.target.wants/* &&\
+        rm -f /etc/systemd/system/*.wants/* &&\
+        rm -f /lib/systemd/system/local-fs.target.wants/* && \
+        rm -f /lib/systemd/system/sockets.target.wants/*udev* && \
+        rm -f /lib/systemd/system/sockets.target.wants/*initctl* && \
+        rm -f /lib/systemd/system/basic.target.wants/* &&\
         rm -f /lib/systemd/system/anaconda.target.wants/* && \
     yum -y clean all
 
@@ -75,13 +75,13 @@ EXPOSE 8080
 RUN echo 'root:password' | chpasswd
 VOLUME [ "/sys/fs/cgroup" ]
 
-RUN systemctl enable swift-gen-builders.service;\
-systemctl enable memcached.service;\
-systemctl enable swift-proxy.service;\
-systemctl enable swift-account.service;\
-systemctl enable swift-container.service;\
-systemctl enable swift-object.service;\
-systemctl enable swift-adduser.service;
+RUN systemctl enable swift-gen-builders.service &&\
+systemctl enable memcached.service &&\
+systemctl enable swift-proxy.service &&\
+systemctl enable swift-account.service &&\
+systemctl enable swift-container.service &&\
+systemctl enable swift-object.service &&\
+systemctl enable swift-adduser.service
 
 ENTRYPOINT ["/usr/local/bin/update_gluster_vol.sh"]
 CMD ["/usr/sbin/init"]
-- 
cgit v1.2.3