From 414175df25f26a596d9cf9ffdb4462b1e7309867 Mon Sep 17 00:00:00 2001 From: "Liu, Jianjun" Date: Thu, 13 Jun 2019 13:32:00 +0000 Subject: [PATCH] only copy delta files when multistage build For some Host OS configuration with redirect_dir on, extra data are saved on the upper layer when the same file exists on different layers. To minimize docker image size, remove the overlapped files before copy. Signed-off-by: Liu, Jianjun --- redis/Dockerfile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/redis/Dockerfile b/redis/Dockerfile index 4934c4a..fb23ea3 100644 --- a/redis/Dockerfile +++ b/redis/Dockerfile @@ -18,6 +18,15 @@ RUN source /os-release && \ --bundles=redis-native,findutils --no-scripts \ && rm -rf /install_root/var/lib/swupd/* +# For some Host OS configuration with redirect_dir on, +# extra data are saved on the upper layer when the same +# file exists on different layers. To minimize docker +# image size, remove the overlapped files before copy. +RUN mkdir /os_core_install +COPY --from=clearlinux/os-core:latest / /os_core_install/ +RUN cd / && \ + find os_core_install | sed -e 's/os_core_install/install_root/' | xargs rm -d || true + FROM clearlinux/os-core:latest MAINTAINER qi.zheng@intel.com