From af079103b87e051dd3a0e171ace51297092f1504 Mon Sep 17 00:00:00 2001
From: lcappelli <laura.cappelli@cnaf.infn.it>
Date: Tue, 26 Apr 2022 12:53:02 +0000
Subject: [PATCH] Merge all 'yum install' commands in a single layer

To create the image defined in this dockerfile, we've merged three differend images:
 * storm2/build/base
 * storm2/build/ngx-voms-build [issue-17]
 * storm2/ngx_http_voms_module/.devcontainer
Each image has this own 'yum install' command with the packages needed for that layer.

With this commit, all the packages are installed in a single layer to reduce the image dimension.
All the 'yum install' commands are grouped in the setup.sh script.
---
 .devcontainer/Dockerfile      | 15 +++------------
 .devcontainer/assets/setup.sh | 15 +++++++++++++++
 2 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
index b162613..da53f56 100644
--- a/.devcontainer/Dockerfile
+++ b/.devcontainer/Dockerfile
@@ -18,23 +18,14 @@ COPY assets/user-setup.sh /docker/
 COPY assets/build-install-openresty.sh /docker/
 
 RUN yum update -y && \
-    yum install -y hostname epel-release which wget tar sudo file && \
+    sh /docker/setup.sh && \
     sh /docker/provide-user.sh ${VSCODE_USER} ${VSCODE_USER_UID} ${VSCODE_GID} && \
-    yum clean all && \
-    rm -rf /var/cache/yum
+    yum clean all && rm -rf /var/cache/yum
 
 COPY --chown=$VSCODE_USER:$VSCODE_USER assets/nginx-httpg_no_delegation.patch /home/$VSCODE_USER/
 COPY --chown=$VSCODE_USER:$VSCODE_USER assets/build-install-ngx-voms.sh /home/$VSCODE_USER/bin/
-RUN sh /docker/setup.sh
 
 USER $VSCODE_USER
 
 RUN sh /docker/build-install-openresty.sh && \
-    sh /docker/user-setup.sh
-
-USER root
-
-RUN yum install -y https://repo.ius.io/ius-release-el7.rpm centos-release-scl \
-    && yum install -y git224 devtoolset-10
-
-USER $VSCODE_USER
\ No newline at end of file
+    sh /docker/user-setup.sh
\ No newline at end of file
diff --git a/.devcontainer/assets/setup.sh b/.devcontainer/assets/setup.sh
index 7238be3..b07ff16 100644
--- a/.devcontainer/assets/setup.sh
+++ b/.devcontainer/assets/setup.sh
@@ -3,6 +3,15 @@ set -ex
 
 yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
 
+yum -y install \
+    hostname \
+    epel-release \
+    which \
+    wget \
+    tar \
+    sudo \
+    file
+
 yum -y install \
     gcc-c++ \
     GeoIP-devel \
@@ -20,3 +29,9 @@ yum -y install \
     make \
     patch \
     less
+
+yum -y install https://repo.ius.io/ius-release-el7.rpm centos-release-scl
+
+yum -y install \
+    git224 \
+    devtoolset-10
-- 
GitLab