From 9c7eaefadecb669a5ea0ae52512f54e5a3b93202 Mon Sep 17 00:00:00 2001 From: abhishek8shankar <127825992+abhishek8shankar@users.noreply.github.com> Date: Wed, 20 Mar 2024 15:22:26 +0530 Subject: [PATCH 1/6] [MOSIP-31575] Updated docker file. Signed-off-by: abhishek8shankar <127825992+abhishek8shankar@users.noreply.github.com> --- mediator/Dockerfile | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/mediator/Dockerfile b/mediator/Dockerfile index d5f19ab..6adaa10 100644 --- a/mediator/Dockerfile +++ b/mediator/Dockerfile @@ -1,47 +1,31 @@ FROM openjdk:11-jre -# can be passed during Docker build as build time environment for github branch to pickup configuration from. +# can be passed during Docker build as build time environment for github branch to pickup configuration from | spring profiles active and config server URL ARG spring_config_label - -# can be passed during Docker build as build time environment for spring profiles active ARG active_profile - -# can be passed during Docker build as build time environment for config server URL ARG spring_config_url -# environment variable to pass active profile such as DEV, QA etc at docker runtime +# environment variable to pass active profile such as DEV, QA etc at docker runtime | config url to pickup configuration from, at docker runtime | github branch to pickup configuration from, at docker runtime ENV active_profile_env=${active_profile} - -# environment variable to pass config url to pickup configuration from, at docker runtime ENV spring_config_url_env=${spring_config_url} - -# environment variable to pass github branch to pickup configuration from, at docker runtime ENV spring_config_label_env=${spring_config_label} # 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 -# install packages and create user +# install packages, create user and change permissions of file inside working dir RUN apt-get -y update \ && apt-get install -y unzip \ && groupadd -g ${container_user_gid} ${container_user_group} \ -&& useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/sh -m ${container_user} +&& useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/sh -m ${container_user} \ +&& chown -R ${container_user}:${container_user} /home/${container_user} # set working directory for the user WORKDIR /home/${container_user} -# change permissions of file inside working dir -RUN chown -R ${container_user}:${container_user} /home/${container_user} - EXPOSE 4545 ADD --chown=${container_user}:${container_user} ./target/opencrvs-mediator-*-spring-boot.jar opencrvs-mediator.jar @@ -49,4 +33,4 @@ ADD --chown=${container_user}:${container_user} ./target/opencrvs-mediator-*-spr # select container user for all tasks USER ${container_user_uid}:${container_user_gid} -CMD java -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" -jar opencrvs-mediator.jar \ No newline at end of file +CMD java -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" -jar opencrvs-mediator.jar From 21e227d3596d0643b28394659a691ef556d980ea Mon Sep 17 00:00:00 2001 From: abhishek8shankar <127825992+abhishek8shankar@users.noreply.github.com> Date: Wed, 20 Mar 2024 15:24:20 +0530 Subject: [PATCH 2/6] [MOSIP-31575] Updated docker file. Signed-off-by: abhishek8shankar <127825992+abhishek8shankar@users.noreply.github.com> --- .../Dockerfile | 28 ++++--------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/registration-processor-opencrvs-stage/Dockerfile b/registration-processor-opencrvs-stage/Dockerfile index 2e43782..d24e85e 100644 --- a/registration-processor-opencrvs-stage/Dockerfile +++ b/registration-processor-opencrvs-stage/Dockerfile @@ -1,47 +1,31 @@ FROM openjdk:11-jre -# can be passed during Docker build as build time environment for github branch to pickup configuration from. +# can be passed during Docker build as build time environment for github branch to pickup configuration from | spring profiles active and config server URL ARG spring_config_label - -# can be passed during Docker build as build time environment for spring profiles active ARG active_profile - -# can be passed during Docker build as build time environment for config server URL ARG spring_config_url -# environment variable to pass active profile such as DEV, QA etc at docker runtime +# environment variable to pass active profile such as DEV, QA etc at docker runtime | config url to pickup configuration from, at docker runtime | github branch to pickup configuration from, at docker runtime ENV active_profile_env=${active_profile} - -# environment variable to pass config url to pickup configuration from, at docker runtime ENV spring_config_url_env=${spring_config_url} - -# environment variable to pass github branch to pickup configuration from, at docker runtime ENV spring_config_label_env=${spring_config_label} # 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 -# install packages and create user +# install packages, create user and change permissions of file inside working dir RUN apt-get -y update \ && apt-get install -y unzip \ && groupadd -g ${container_user_gid} ${container_user_group} \ -&& useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/sh -m ${container_user} +&& useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/sh -m ${container_user} \ +&& chown -R ${container_user}:${container_user} /home/${container_user} # set working directory for the user WORKDIR /home/${container_user} -# change permissions of file inside working dir -RUN chown -R ${container_user}:${container_user} /home/${container_user} - EXPOSE 8045 ADD --chown=${container_user}:${container_user} ./target/registration-processor-opencrvs-stage-*-spring-boot.jar registration-processor-opencrvs-stage.jar @@ -49,4 +33,4 @@ ADD --chown=${container_user}:${container_user} ./target/registration-processor- # select container user for all tasks USER ${container_user_uid}:${container_user_gid} -CMD java -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" -jar registration-processor-opencrvs-stage.jar \ No newline at end of file +CMD java -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" -jar registration-processor-opencrvs-stage.jar From 1c15cfeb52659335aeaf8fc37ffed453c09827e1 Mon Sep 17 00:00:00 2001 From: abhishek8shankar <127825992+abhishek8shankar@users.noreply.github.com> Date: Wed, 20 Mar 2024 15:25:15 +0530 Subject: [PATCH 3/6] Update push-trigger.yml Signed-off-by: abhishek8shankar <127825992+abhishek8shankar@users.noreply.github.com> --- .github/workflows/push-trigger.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/push-trigger.yml b/.github/workflows/push-trigger.yml index 3f9797f..c5337a9 100644 --- a/.github/workflows/push-trigger.yml +++ b/.github/workflows/push-trigger.yml @@ -44,7 +44,7 @@ jobs: BUILD_ARTIFACT: 'opencrvs-mediator' fail-fast: false name: ${{ matrix.SERVICE_NAME }} - uses: mosip/kattu/.github/workflows/docker-build.yml@master + uses: abhishek8shankar/kattu/.github/workflows/docker-build.yml@develop with: SERVICE_LOCATION: ${{ matrix.SERVICE_LOCATION }} SERVICE_NAME: ${{ matrix.SERVICE_NAME }} @@ -77,7 +77,7 @@ jobs: BUILD_ARTIFACT: 'registration-processor-opencrvs-stage' fail-fast: false name: ${{ matrix.SERVICE_NAME }} - uses: mosip/kattu/.github/workflows/docker-build.yml@master + uses: abhishek8shankar/kattu/.github/workflows/docker-build.yml@develop with: SERVICE_LOCATION: ${{ matrix.SERVICE_LOCATION }} SERVICE_NAME: ${{ matrix.SERVICE_NAME }} @@ -86,4 +86,4 @@ jobs: DEV_NAMESPACE_DOCKER_HUB: ${{ secrets.DEV_NAMESPACE_DOCKER_HUB }} ACTOR_DOCKER_HUB: ${{ secrets.ACTOR_DOCKER_HUB }} RELEASE_DOCKER_HUB: ${{ secrets.RELEASE_DOCKER_HUB }} - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} \ No newline at end of file + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} From 1bcb7101b936c7bee500b8abe997b43a43277712 Mon Sep 17 00:00:00 2001 From: abhishek8shankar <127825992+abhishek8shankar@users.noreply.github.com> Date: Wed, 20 Mar 2024 15:32:12 +0530 Subject: [PATCH 4/6] Update push-trigger.yml Signed-off-by: abhishek8shankar <127825992+abhishek8shankar@users.noreply.github.com> --- .github/workflows/push-trigger.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/push-trigger.yml b/.github/workflows/push-trigger.yml index c5337a9..0209515 100644 --- a/.github/workflows/push-trigger.yml +++ b/.github/workflows/push-trigger.yml @@ -44,7 +44,7 @@ jobs: BUILD_ARTIFACT: 'opencrvs-mediator' fail-fast: false name: ${{ matrix.SERVICE_NAME }} - uses: abhishek8shankar/kattu/.github/workflows/docker-build.yml@develop + uses: mosip/kattu/.github/workflows/docker-build.yml@master with: SERVICE_LOCATION: ${{ matrix.SERVICE_LOCATION }} SERVICE_NAME: ${{ matrix.SERVICE_NAME }} @@ -77,7 +77,7 @@ jobs: BUILD_ARTIFACT: 'registration-processor-opencrvs-stage' fail-fast: false name: ${{ matrix.SERVICE_NAME }} - uses: abhishek8shankar/kattu/.github/workflows/docker-build.yml@develop + uses: mosip/kattu/.github/workflows/docker-build.yml@master with: SERVICE_LOCATION: ${{ matrix.SERVICE_LOCATION }} SERVICE_NAME: ${{ matrix.SERVICE_NAME }} From 9c847acf259297b4908923570772f5a8f4014a76 Mon Sep 17 00:00:00 2001 From: abhishek8shankar <127825992+abhishek8shankar@users.noreply.github.com> Date: Fri, 12 Apr 2024 19:51:15 +0530 Subject: [PATCH 5/6] [MOSIP-31575] Updated docker file. Signed-off-by: abhishek8shankar <127825992+abhishek8shankar@users.noreply.github.com> --- mediator/Dockerfile | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/mediator/Dockerfile b/mediator/Dockerfile index 6adaa10..5984c5d 100644 --- a/mediator/Dockerfile +++ b/mediator/Dockerfile @@ -1,14 +1,13 @@ FROM openjdk:11-jre -# can be passed during Docker build as build time environment for github branch to pickup configuration from | spring profiles active and config server URL +# can be passed during Docker build as build time environment for github branch to pickup configuration from. ARG spring_config_label + +# can be passed during Docker build as build time environment for spring profiles active ARG active_profile -ARG spring_config_url -# environment variable to pass active profile such as DEV, QA etc at docker runtime | config url to pickup configuration from, at docker runtime | github branch to pickup configuration from, at docker runtime -ENV active_profile_env=${active_profile} -ENV spring_config_url_env=${spring_config_url} -ENV spring_config_label_env=${spring_config_label} +# can be passed during Docker build as build time environment for config server URL +ARG spring_config_url # can be passed during Docker build as build time environment for github branch to pickup configuration from. ARG container_user=mosip @@ -16,6 +15,27 @@ ARG container_user_group=mosip ARG container_user_uid=1001 ARG container_user_gid=1001 +# can be passed during Docker build as build time environment for label related addition to docker. +ARG SOURCE +ARG COMMIT_HASH +ARG COMMIT_ID +ARG BUILD_TIME + +# environment variable to pass active profile such as DEV, QA etc at docker runtime +ENV active_profile_env=${active_profile} + +# environment variable to pass config url to pickup configuration from, at docker runtime +ENV spring_config_url_env=${spring_config_url} + +# environment variable to pass github branch to pickup configuration from, at docker runtime +ENV spring_config_label_env=${spring_config_label} + +# can be passed during Docker build as build time environment for label. +LABEL source=${SOURCE} +LABEL commit_hash=${COMMIT_HASH} +LABEL commit_id=${COMMIT_ID} +LABEL build_time=${BUILD_TIME} + # install packages, create user and change permissions of file inside working dir RUN apt-get -y update \ && apt-get install -y unzip \ From 8b6aae9b0d61d8f6b1ef8f11f1dd2b4280ca8e12 Mon Sep 17 00:00:00 2001 From: abhishek8shankar <127825992+abhishek8shankar@users.noreply.github.com> Date: Fri, 12 Apr 2024 19:52:11 +0530 Subject: [PATCH 6/6] [MOSIP-31575] Updated docker file. Signed-off-by: abhishek8shankar <127825992+abhishek8shankar@users.noreply.github.com> --- .../Dockerfile | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/registration-processor-opencrvs-stage/Dockerfile b/registration-processor-opencrvs-stage/Dockerfile index d24e85e..989fea2 100644 --- a/registration-processor-opencrvs-stage/Dockerfile +++ b/registration-processor-opencrvs-stage/Dockerfile @@ -1,14 +1,13 @@ FROM openjdk:11-jre -# can be passed during Docker build as build time environment for github branch to pickup configuration from | spring profiles active and config server URL +# can be passed during Docker build as build time environment for github branch to pickup configuration from. ARG spring_config_label + +# can be passed during Docker build as build time environment for spring profiles active ARG active_profile -ARG spring_config_url -# environment variable to pass active profile such as DEV, QA etc at docker runtime | config url to pickup configuration from, at docker runtime | github branch to pickup configuration from, at docker runtime -ENV active_profile_env=${active_profile} -ENV spring_config_url_env=${spring_config_url} -ENV spring_config_label_env=${spring_config_label} +# can be passed during Docker build as build time environment for config server URL +ARG spring_config_url # can be passed during Docker build as build time environment for github branch to pickup configuration from. ARG container_user=mosip @@ -16,6 +15,27 @@ ARG container_user_group=mosip ARG container_user_uid=1001 ARG container_user_gid=1001 +# can be passed during Docker build as build time environment for label related addition to docker. +ARG SOURCE +ARG COMMIT_HASH +ARG COMMIT_ID +ARG BUILD_TIME + +# environment variable to pass active profile such as DEV, QA etc at docker runtime +ENV active_profile_env=${active_profile} + +# environment variable to pass config url to pickup configuration from, at docker runtime +ENV spring_config_url_env=${spring_config_url} + +# environment variable to pass github branch to pickup configuration from, at docker runtime +ENV spring_config_label_env=${spring_config_label} + +# can be passed during Docker build as build time environment for label. +LABEL source=${SOURCE} +LABEL commit_hash=${COMMIT_HASH} +LABEL commit_id=${COMMIT_ID} +LABEL build_time=${BUILD_TIME} + # install packages, create user and change permissions of file inside working dir RUN apt-get -y update \ && apt-get install -y unzip \