Use "--no-install-recommends" to avoid installing many packages that
aren't needed, many are *-doc packages. Also start using the -slim
base image as they remove a few unused files/directories, like docs/.

Explicitly install "ca-certificates" as it is only recommended for
"wget".
Explicitly install "ocaml-findlib" as it is only recommended for
"libfindlib-ocaml-dev".

Using "--no-install-recommends" saves about 600MB on the uncompress
image. 2.89GB vs 2.3GB (value from `docker image list`).

Switching to -slim save about 130MB.

Overwall, we go from 2.89GB to 2.17GB.

Signed-off-by: Anthony PERARD <[email protected]>
---

Notes:
    Change to use "-slim" was proposed by Andy. I went futher and added
    --no-install-recommends.
    
    I've tried to find other missing packages by looking at differences
    in  "tools/config.log", "stubdom/config.log", "config/", and
    "xen/.config".
    
    A test is in progress to check that no jobs are broken, but result
    probably not before next week.
        
https://gitlab.com/xen-project/people/anthonyper/xen/-/pipelines/795600920
    
    I've only tested gcc debug=n on x86_64 locally.

 automation/build/debian/unstable-i386.dockerfile | 6 ++++--
 automation/build/debian/unstable.dockerfile      | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/automation/build/debian/unstable-i386.dockerfile 
b/automation/build/debian/unstable-i386.dockerfile
index 1c4928b09e..cc116d32e9 100644
--- a/automation/build/debian/unstable-i386.dockerfile
+++ b/automation/build/debian/unstable-i386.dockerfile
@@ -1,4 +1,4 @@
-FROM i386/debian:unstable
+FROM i386/debian:unstable-slim
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="[email protected]"
 
@@ -12,7 +12,8 @@ ENTRYPOINT ["linux32"]
 
 # build depends
 RUN apt-get update && \
-    apt-get --quiet --yes install \
+    apt-get --quiet --no-install-recommends --yes install \
+        ca-certificates \
         build-essential \
         zlib1g-dev \
         libncurses5-dev \
@@ -35,6 +36,7 @@ RUN apt-get update && \
         libc6-dev \
         libnl-3-dev \
         ocaml-nox \
+        ocaml-findlib \
         libfindlib-ocaml-dev \
         markdown \
         transfig \
diff --git a/automation/build/debian/unstable.dockerfile 
b/automation/build/debian/unstable.dockerfile
index 6ef2878200..06ac909a85 100644
--- a/automation/build/debian/unstable.dockerfile
+++ b/automation/build/debian/unstable.dockerfile
@@ -1,4 +1,4 @@
-FROM debian:unstable
+FROM debian:unstable-slim
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="[email protected]"
 
@@ -10,7 +10,8 @@ WORKDIR /build
 
 # build depends
 RUN apt-get update && \
-    apt-get --quiet --yes install \
+    apt-get --quiet --no-install-recommends --yes install \
+        ca-certificates \
         build-essential \
         zlib1g-dev \
         libncurses5-dev \
@@ -34,6 +35,7 @@ RUN apt-get update && \
         libc6-dev-i386 \
         libnl-3-dev \
         ocaml-nox \
+        ocaml-findlib \
         libfindlib-ocaml-dev \
         markdown \
         transfig \
-- 
Anthony PERARD


Reply via email to