From 8a8844c3e6fd60a0d00dc7455b667d4d410a536f Mon Sep 17 00:00:00 2001 From: Qi Zheng Date: Wed, 15 May 2019 16:31:01 +0800 Subject: [PATCH] Make the swupd update always be the layer two To help analyze the container image size by layers, assume each container image be comprised of: Layer 1: clearlinux:latest Layer 2: swupd update Other layers: the container configurations With this, we can continue to optimize layer size accordingly. Signed-off-by: Qi Zheng --- cgit/Dockerfile | 6 +++--- elasticsearch/Dockerfile | 4 ++-- haproxy/Dockerfile | 2 +- httpd/Dockerfile | 4 ++-- iperf/Dockerfile | 5 +++-- mariadb/Dockerfile | 4 ++-- memcached/Dockerfile | 4 ++-- nginx/Dockerfile | 7 ++++--- node/Dockerfile | 6 ++---- openjdk/Dockerfile | 6 +++--- php/Dockerfile | 4 ++-- postgres/Dockerfile | 7 +++++-- python/Dockerfile | 8 +++++--- redis/Dockerfile | 4 ++-- ruby/Dockerfile | 6 +++--- 15 files changed, 41 insertions(+), 36 deletions(-) diff --git a/cgit/Dockerfile b/cgit/Dockerfile index 78dd45a..e6f9a0e 100644 --- a/cgit/Dockerfile +++ b/cgit/Dockerfile @@ -1,9 +1,9 @@ FROM clearlinux/httpd ARG swupd_args -RUN swupd update $swupd_args -RUN swupd bundle-add sudo curl scm-server $swupd_args -RUN rm -rf /var/lib/swupd +RUN swupd update --no-boot-update $swupd_args +RUN swupd bundle-add sudo curl scm-server $swupd_args \ + && rm -rf /var/lib/swupd/* COPY cgitrc /etc/cgitrc COPY httpd-cgit.conf /etc/httpd/conf.d/httpd-cgit.conf diff --git a/elasticsearch/Dockerfile b/elasticsearch/Dockerfile index e552f32..2e81260 100644 --- a/elasticsearch/Dockerfile +++ b/elasticsearch/Dockerfile @@ -3,8 +3,8 @@ MAINTAINER qi.zheng@intel.com ARG swupd_args -RUN swupd update $swupd_args \ - && swupd bundle-add elasticsearch $swupd_args \ +RUN swupd update --no-boot-update $swupd_args +RUN swupd bundle-add elasticsearch $swupd_args \ && rm -rf /var/lib/swupd/* RUN set -ex \ diff --git a/haproxy/Dockerfile b/haproxy/Dockerfile index e6c148d..fc15c93 100644 --- a/haproxy/Dockerfile +++ b/haproxy/Dockerfile @@ -6,7 +6,7 @@ ARG swupd_args RUN swupd update --no-boot-update $swupd_args RUN swupd bundle-add haproxy $swupd_args \ - && rm -rf /var/lib/swupd \ + && rm -rf /var/lib/swupd/* \ && mkdir -p /usr/local/etc/haproxy STOPSIGNAL SIGUSR1 diff --git a/httpd/Dockerfile b/httpd/Dockerfile index f77375e..91be879 100644 --- a/httpd/Dockerfile +++ b/httpd/Dockerfile @@ -3,8 +3,8 @@ MAINTAINER qi.zheng@intel.com ARG swupd_args -RUN swupd update $swupd_args \ - && swupd bundle-add httpd $swupd_args \ +RUN swupd update --no-boot-update $swupd_args +RUN swupd bundle-add httpd $swupd_args \ && rm -rf /var/lib/swupd/* #default configuration on /usr/share/defaults/httpd/httpd.conf diff --git a/iperf/Dockerfile b/iperf/Dockerfile index 71f6d9d..76f58b6 100644 --- a/iperf/Dockerfile +++ b/iperf/Dockerfile @@ -3,8 +3,9 @@ MAINTAINER long1.wang@intel.com ARG swupd_args -RUN swupd update --no-boot-update $swupd_args && \ - swupd bundle-add iperf $swupd_args +RUN swupd update --no-boot-update $swupd_args +RUN swupd bundle-add iperf $swupd_args \ + && rm -rf /var/lib/swupd/* # Define default command ENTRYPOINT ["iperf3"] diff --git a/mariadb/Dockerfile b/mariadb/Dockerfile index 3362161..33bd037 100644 --- a/mariadb/Dockerfile +++ b/mariadb/Dockerfile @@ -3,8 +3,8 @@ MAINTAINER qi.zheng@intel.com ARG swupd_args -RUN swupd update $swupd_args \ - && swupd bundle-add mariadb $swupd_args \ +RUN swupd update --no-boot-update $swupd_args +RUN swupd bundle-add mariadb $swupd_args \ && rm -rf /var/lib/swupd/* RUN mkdir /docker-entrypoint-initdb.d diff --git a/memcached/Dockerfile b/memcached/Dockerfile index 6fbd86f..0c646ef 100644 --- a/memcached/Dockerfile +++ b/memcached/Dockerfile @@ -3,8 +3,8 @@ MAINTAINER qi.zheng@intel.com ARG swupd_args -RUN swupd update $swupd_args \ - && swupd bundle-add memcached $swupd_args \ +RUN swupd update --no-boot-update $swupd_args +RUN swupd bundle-add memcached $swupd_args \ && rm -rf /var/lib/swupd/* COPY docker-entrypoint.sh /usr/local/bin/ diff --git a/nginx/Dockerfile b/nginx/Dockerfile index 4f0a86b..02fe7c8 100644 --- a/nginx/Dockerfile +++ b/nginx/Dockerfile @@ -3,11 +3,12 @@ MAINTAINER bin.yang@intel.com ARG swupd_args +RUN swupd update --no-boot-update $swupd_args + COPY default.conf /etc/nginx/conf.d/default.conf -RUN swupd update --no-boot-update $swupd_args && \ - swupd bundle-add nginx $swupd_args && \ - rm -rf /var/lib/swupd && \ +RUN swupd bundle-add nginx $swupd_args && \ + rm -rf /var/lib/swupd/* && \ mkdir -p /var/log/nginx && \ # forward request and error logs to docker log collector ln -sf /dev/stdout /var/log/nginx/access.log && \ diff --git a/node/Dockerfile b/node/Dockerfile index c7935e3..33f170b 100644 --- a/node/Dockerfile +++ b/node/Dockerfile @@ -3,10 +3,8 @@ MAINTAINER jianjun.liu@intel.com ARG swupd_args -RUN swupd update $swupd_args \ - && swupd bundle-add nodejs-basic $swupd_args \ +RUN swupd update --no-boot-update $swupd_args +RUN swupd bundle-add nodejs-basic $swupd_args \ && rm -rf /var/lib/swupd/* -RUN /usr/bin/ldconfig - CMD ["node"] diff --git a/openjdk/Dockerfile b/openjdk/Dockerfile index e88954e..ceb8cd0 100644 --- a/openjdk/Dockerfile +++ b/openjdk/Dockerfile @@ -3,8 +3,8 @@ MAINTAINER long1.wang@intel.com ARG swupd_args -RUN swupd update --no-boot-update $swupd_args && \ - swupd bundle-add java-runtime $swupd_args && \ - rm -rf /var/lib/swupd +RUN swupd update --no-boot-update $swupd_args +RUN swupd bundle-add java-runtime $swupd_args && \ + rm -rf /var/lib/swupd/* CMD ["java"] diff --git a/php/Dockerfile b/php/Dockerfile index 121e78b..ef7569e 100644 --- a/php/Dockerfile +++ b/php/Dockerfile @@ -3,8 +3,8 @@ MAINTAINER jianjun.liu@intel.com ARG swupd_args -RUN swupd update $swupd_args \ - && swupd bundle-add php-basic $swupd_args \ +RUN swupd update --no-boot-update $swupd_args +RUN swupd bundle-add php-basic $swupd_args \ && rm -rf /var/lib/swupd/* CMD ["php","-a"] diff --git a/postgres/Dockerfile b/postgres/Dockerfile index 5d57ff4..974f7df 100644 --- a/postgres/Dockerfile +++ b/postgres/Dockerfile @@ -1,8 +1,11 @@ FROM clearlinux:latest MAINTAINER william.douglas@intel.com -RUN swupd update $swupd_args && \ - swupd bundle-add postgresql $swupd_args +ARG swupd_args + +RUN swupd update --no-boot-update $swupd_args +RUN swupd bundle-add postgresql $swupd_args \ + && rm -rf /var/lib/swupd/* ENV PGDATA /var/lib/pgsql/data RUN mkdir -p /run/postgresql && chown -R postgres:postgres /run/postgresql diff --git a/python/Dockerfile b/python/Dockerfile index d1ac0e8..62d4e77 100644 --- a/python/Dockerfile +++ b/python/Dockerfile @@ -1,8 +1,10 @@ FROM clearlinux:latest MAINTAINER hongzhan.chen@intel.com -RUN swupd update $swupd_args && \ - swupd bundle-add python3-basic $swupd_args -RUN rm -rf /var/lib/swupd +ARG swupd_args + +RUN swupd update --no-boot-update $swupd_args +RUN swupd bundle-add python3-basic $swupd_args \ + && rm -rf /var/lib/swupd/* CMD ["python3"] diff --git a/redis/Dockerfile b/redis/Dockerfile index 7186e83..0353c13 100644 --- a/redis/Dockerfile +++ b/redis/Dockerfile @@ -3,8 +3,8 @@ MAINTAINER qi.zheng@intel.com ARG swupd_args -RUN swupd update $swupd_args \ - && swupd bundle-add redis-native $swupd_args \ +RUN swupd update --no-boot-update $swupd_args +RUN swupd bundle-add redis-native $swupd_args \ && rm -rf /var/lib/swupd/* \ && mkdir /data && chown redis:redis /data diff --git a/ruby/Dockerfile b/ruby/Dockerfile index e3f6ea6..c9ad200 100644 --- a/ruby/Dockerfile +++ b/ruby/Dockerfile @@ -1,8 +1,8 @@ FROM clearlinux:latest MAINTAINER hongzhan.chen@intel.com -RUN swupd update --no-boot-update $swupd_args && \ - swupd bundle-add ruby-basic $swupd_args -RUN rm -rf /var/lib/swupd +RUN swupd update --no-boot-update $swupd_args +RUN swupd bundle-add ruby-basic $swupd_args \ + && rm -rf /var/lib/swupd/* CMD ["irb"]