From 6f1b9daa1cd2012a38d8be5e16a93ead3a7c43d5 Mon Sep 17 00:00:00 2001 From: abhishek8shankar <127825992+abhishek8shankar@users.noreply.github.com> Date: Wed, 27 Mar 2024 11:41:08 +0530 Subject: [PATCH 1/2] [MOSIP-31575] Updated docker file. Signed-off-by: abhishek8shankar <127825992+abhishek8shankar@users.noreply.github.com> --- admin-ui/Dockerfile | 51 +++++++++------------------------------------ 1 file changed, 10 insertions(+), 41 deletions(-) diff --git a/admin-ui/Dockerfile b/admin-ui/Dockerfile index bc5b339f..2b490de7 100644 --- a/admin-ui/Dockerfile +++ b/admin-ui/Dockerfile @@ -18,17 +18,10 @@ ENV entity_spec_path=${base_path}/assets/entity-spec ENV master_template_path=${base_path}/templates - # can be passed during Docker build as build time environment for github branch to pickup configuration from. ARG container_user=mosip - -# can be passed during Docker build as build time environment for github branch to pickup configuration from. ARG container_user_group=mosip - -# can be passed during Docker build as build time environment for github branch to pickup configuration from. ARG container_user_uid=1001 - -# can be passed during Docker build as build time environment for github branch to pickup configuration from. ARG container_user_gid=1001 # can be passed during Docker build as build time environment for artifactory URL @@ -37,14 +30,6 @@ ARG artifactory_url # environment variable to pass artifactory url, at docker runtime ENV artifactory_url_env=${artifactory_url} -# install packages and create user -RUN apt-get -y update \ -&& apt-get install -y unzip wget zip npm \ -&& groupadd -g ${container_user_gid} ${container_user_group} \ -&& useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/sh -m ${container_user} \ -&& mkdir -p /var/run/nginx /var/tmp/nginx \ -&& chown -R ${container_user}:${container_user} /usr/share/nginx /var/run/nginx /var/tmp/nginx - # set working directory for the user WORKDIR /home/${container_user} @@ -54,24 +39,23 @@ ADD ./default.conf /etc/nginx/conf.d/ ADD ./download.conf /etc/nginx/include/download.conf -RUN cd /home/${container_user} - ADD dist ${base_path} # install the needed packages including wget and a unzip library #RUN apt-get update -y && apt-get install -y wget && apt-get install -y unzip -# change permissions of file inside working dir -RUN chown -R ${container_user}:${container_user} ${base_path}/assets/i18n -RUN chown -R ${container_user}:${container_user} ${base_path}/assets/entity-spec -RUN mkdir -p ${master_template_path} && chown -R ${container_user}:${container_user} ${master_template_path} - - ADD configure_start.sh configure_start.sh -RUN chmod +x configure_start.sh - -RUN chown -R ${container_user}:${container_user} /home/${container_user} +## install packages, create user and change permissions of file inside working dir +RUN apt-get -y update \ +&& apt-get install -y unzip wget zip npm \ +&& groupadd -g ${container_user_gid} ${container_user_group} \ +&& useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/sh -m ${container_user} \ +&& mkdir -p /var/run/nginx /var/tmp/nginx \ +&& chown -R ${container_user}:${container_user} /home/${container_user} /usr/share/nginx /var/run/nginx /var/tmp/nginx ${base_path}/assets/i18n ${base_path}/assets/entity-spec \ +&& mkdir -p ${master_template_path} && chown -R ${container_user}:${container_user} ${master_template_path} \ +&& chmod +x configure_start.sh \ +&& cd /home/${container_user} # select container user for all tasks USER ${container_user_uid}:${container_user_gid} @@ -82,21 +66,6 @@ ENTRYPOINT [ "./configure_start.sh" ] #get the admin i18n bundle zip from artifactory CMD echo "starting nginx" ; \ -# wget -q --show-progress "${artifactory_url_env}"/artifactory/libs-release-local/i18n/admin-i18n-bundle.zip -O "${i18n_path}"/admin-i18n-bundle.zip ; \ -# echo "Downloading entity spec bundle" ; \ -# wget -q --show-progress "${artifactory_url_env}"/artifactory/libs-release-local/i18n/admin-entity-spec-bundle.zip -O "${entity_spec_path}"/admin-entity-spec-bundle.zip ; \ -# echo "Downloading templates bundle" ; \ -# wget -q --show-progress "${artifactory_url_env}"/artifactory/libs-release-local/master-templates/master-templates.zip -O "${master_template_path}"/master-templates.zip ; \ -# cd ${entity_spec_path} ; \ -# #zip -FF admin-entity-spec-bundle.zip --out admin-entity-spec-bundle_fixed.zip ; \ -# unzip -o admin-entity-spec-bundle.zip ; \ -# cd ${i18n_path} ; \ -# #zip -FF admin-i18n-bundle.zip --out admin-i18n-bundle_fixed.zip ; \ -# unzip -o admin-i18n-bundle.zip ; \ -# cd ${master_template_path} ; \ -# #zip -FF master-templates.zip --out master-templates_fixed.zip ; \ -# unzip -o master-templates.zip ; \ nginx ; \ sleep infinity - From a8c18b703f5806ff1844340b3ff85c792375bfd3 Mon Sep 17 00:00:00 2001 From: abhishek8shankar <127825992+abhishek8shankar@users.noreply.github.com> Date: Wed, 27 Mar 2024 11:41:46 +0530 Subject: [PATCH 2/2] [MOSIP-31575] Updated docker file. Signed-off-by: abhishek8shankar <127825992+abhishek8shankar@users.noreply.github.com> --- admintest/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admintest/Dockerfile b/admintest/Dockerfile index 458f9801..511baca2 100644 --- a/admintest/Dockerfile +++ b/admintest/Dockerfile @@ -28,10 +28,10 @@ ARG KUBECTL_VERSION=1.22.9 # install packages and create user RUN groupadd -g ${container_user_gid} ${container_user_group} \ && useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/bash -m ${container_user} -d ${work_dir} \ - && chown -R ${container_user}:${container_user} /home/${container_user}/ \ + && chown -R ${container_user}:${container_user} /home/${container_user} \ && curl -LO "https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl" \ && chmod +x kubectl \ - && mv kubectl /usr/local/bin/ + && mv kubectl /usr/local/bin/ # Switch to the specified user for the subsequent commands USER ${container_user_uid}:${container_user_gid}