From 82661690060c026d143b7c7c550c385db757a3e8 Mon Sep 17 00:00:00 2001 From: abin Date: Mon, 20 Mar 2023 10:05:04 +0530 Subject: [PATCH] Reduce size of the final GSC image --- templates/centos/Dockerfile.build.template | 11 +++++++---- templates/debian/Dockerfile.build.template | 13 ++++++------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/templates/centos/Dockerfile.build.template b/templates/centos/Dockerfile.build.template index caafdea2..edf6c8bc 100644 --- a/templates/centos/Dockerfile.build.template +++ b/templates/centos/Dockerfile.build.template @@ -17,13 +17,16 @@ RUN dnf update -y \ python3-pip \ python3-protobuf \ && /usr/bin/python3 -B -m pip install click jinja2 protobuf \ - 'tomli>=1.1.0' 'tomli-w>=0.4.0' - + 'tomli>=1.1.0' 'tomli-w>=0.4.0' \ + && dnf repolist \ # For compatibility with Gramine v1.3 or lower -RUN /usr/bin/python3 -B -m pip install 'toml>=0.10' + && /usr/bin/python3 -B -m pip install 'toml>=0.10' \ + && dnf install -y python3-pyelftools \ + && rpm -e --nodeps python3-pip && dnf -y clean all \ + && rm -rf /var/cache/dnf/* \ + && rm -rf /var/lib/dnf/system-upgrade/* # Install pyelftools after the installation of epel-release as it is provided by the EPEL repo -RUN dnf install -y python3-pyelftools {% if debug %} RUN dnf install -y \ diff --git a/templates/debian/Dockerfile.build.template b/templates/debian/Dockerfile.build.template index d304e372..42e7ce40 100644 --- a/templates/debian/Dockerfile.build.template +++ b/templates/debian/Dockerfile.build.template @@ -16,10 +16,13 @@ RUN apt-get update \ python3-protobuf \ python3-pyelftools \ && /usr/bin/python3 -B -m pip install click jinja2 protobuf \ - 'tomli>=1.1.0' 'tomli-w>=0.4.0' - + 'tomli>=1.1.0' 'tomli-w>=0.4.0' \ # For compatibility with Gramine v1.3 or lower -RUN /usr/bin/python3 -B -m pip install 'toml>=0.10' + && /usr/bin/python3 -B -m pip install 'toml>=0.10' \ + && locale-gen en_US.UTF-8 \ + && apt remove -y python3-pip locales locales-all && apt autoremove -y \ + && rm -rf /var/lib/apt/lists/* + {% if debug %} RUN env DEBIAN_FRONTEND=noninteractive apt-get install -y \ @@ -31,8 +34,4 @@ RUN env DEBIAN_FRONTEND=noninteractive apt-get install -y \ vim {% endif %} -RUN locale-gen en_US.UTF-8 -ENV LC_ALL en_US.UTF-8 -ENV LANG en_US.UTF-8 -ENV LANGUAGE en_US.UTF-8 {% endblock %}