From 1a45973e6fd010cfa60132d059aac2f5aed8fb26 Mon Sep 17 00:00:00 2001 From: hackercat Date: Tue, 19 Jan 2021 08:54:12 +0000 Subject: [PATCH] Move cleaning to each layer to further minimise image size --- linux/ubuntu/act/Dockerfile | 12 +++++++----- linux/ubuntu/runner/Dockerfile | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/linux/ubuntu/act/Dockerfile b/linux/ubuntu/act/Dockerfile index ac67213..1088522 100644 --- a/linux/ubuntu/act/Dockerfile +++ b/linux/ubuntu/act/Dockerfile @@ -38,7 +38,12 @@ RUN set -Eeuxo pipefail && \ apt -yq update && \ printf "Updated apt lists and upgraded packages\n\n" && \ apt -yq install --no-install-recommends ssh lsb-release gawk jq curl git wget sudo gnupg-agent ca-certificates software-properties-common apt-transport-https libyaml-0-2 zstd && \ - printf "Installed base utils" + printf "Installed base utils" && \ + printf "Cleaning image" && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + rm -rf /tmp/* && \ + printf "Cleaned up image" # > Install Node.JS RUN set -Eeuxo pipefail && \ @@ -49,10 +54,7 @@ RUN set -Eeuxo pipefail && \ echo "deb-src https://deb.nodesource.com/node_${NODE_VERSION}.x $DISTRO main" | tee -a /etc/apt/sources.list.d/nodesource.list && \ apt -yq update && \ apt -yq install --no-install-recommends nodejs="${NODE_VERSION}*" && \ - printf "Installed Node.JS $(node -v)" - -# > Clean up image -RUN set -Eeuxo pipefail && \ + printf "Installed Node.JS $(node -v)" && \ printf "Cleaning image" && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* && \ diff --git a/linux/ubuntu/runner/Dockerfile b/linux/ubuntu/runner/Dockerfile index 19473d7..9110f8b 100644 --- a/linux/ubuntu/runner/Dockerfile +++ b/linux/ubuntu/runner/Dockerfile @@ -40,7 +40,12 @@ RUN set -Eeuxo pipefail && \ apt -yq update && \ printf "Updated apt lists and upgraded packages\n\n" && \ apt -yq install --no-install-recommends lsb-release gawk jq curl git wget sudo gnupg-agent ca-certificates software-properties-common apt-transport-https zstd && \ - printf "Installed base utils" + printf "Installed base utils" && \ + printf "Cleaning image" && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + rm -rf /tmp/* && \ + printf "Cleaned up image" # > Install Node.JS RUN set -Eeuxo pipefail && \ @@ -51,10 +56,7 @@ RUN set -Eeuxo pipefail && \ echo "deb-src https://deb.nodesource.com/node_${NODE_VERSION}.x $DISTRO main" | tee -a /etc/apt/sources.list.d/nodesource.list && \ apt -yq update && \ apt -yq install --no-install-recommends nodejs="${NODE_VERSION}*" && \ - printf "Installed Node.JS $(node -v)" - -# > Clean up image -RUN set -Eeuxo pipefail && \ + printf "Installed Node.JS $(node -v)" && \ printf "Cleaning image" && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* && \