diff --git a/authentication/authentication-internal-service/Dockerfile b/authentication/authentication-internal-service/Dockerfile index b5239d29a7a..1348a30ba7e 100644 --- a/authentication/authentication-internal-service/Dockerfile +++ b/authentication/authentication-internal-service/Dockerfile @@ -1,21 +1,12 @@ FROM openjdk:11 -ARG SOURCE -ARG COMMIT_HASH -ARG COMMIT_ID -ARG BUILD_TIME -LABEL source=${SOURCE} -LABEL commit_hash=${COMMIT_HASH} -LABEL commit_id=${COMMIT_ID} -LABEL build_time=${BUILD_TIME} - # 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 +# 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 +# can be passed during Docker build as build time environment for config server URL ARG spring_config_url #ARG bio_sdk_folder=mock/0.9 @@ -33,6 +24,24 @@ ARG is_glowroot # can be passed during Docker build as build time environment for artifactory URL ARG artifactory_url +ARG biosdk_local_dir=biosdk-client + +ARG demosdk_local_dir=demosdk + +ARG hsm_local_dir=hsm-client + +# can be passed during Docker build as build time environment for github branch to pickup configuration from. +ARG container_user=mosip +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} @@ -60,38 +69,17 @@ ENV demosdk_zip_file_path=${demosdk_zip_path} #ENV zip_file_path=${client_zip_path} ENV hsm_zip_file_path=${hsm_client_zip_path} -# 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 - -ARG hsm_local_dir=hsm-client - ENV hsm_local_dir_name=${hsm_local_dir} -ARG biosdk_local_dir=biosdk-client - -ARG demosdk_local_dir=demosdk - ENV biosdk_local_dir_name=${biosdk_local_dir} ENV demosdk_local_dir_name=${demosdk_local_dir} -# install packages and create user -RUN apt-get -y update \ -&& apt-get install -y unzip sudo \ -&& groupadd -g ${container_user_gid} ${container_user_group} \ -&& useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/sh -m ${container_user} \ -&& adduser ${container_user} sudo \ -&& echo "%sudo ALL=(ALL) NOPASSWD:/home/${container_user}/${hsm_local_dir}/install.sh" >> /etc/sudoers \ -&& echo "%sudo ALL=(ALL) NOPASSWD:/home/${container_user}/${biosdk_local_dir}/install.sh" >> /etc/sudoers +# 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} # set working directory for the user WORKDIR /home/${container_user} @@ -118,8 +106,15 @@ EXPOSE 8093 EXPOSE 9010 -# change permissions of file inside working dir -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 sudo \ +&& groupadd -g ${container_user_gid} ${container_user_group} \ +&& useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/sh -m ${container_user} \ +&& adduser ${container_user} sudo \ +&& echo "%sudo ALL=(ALL) NOPASSWD:/home/${container_user}/${hsm_local_dir}/install.sh" >> /etc/sudoers \ +&& echo "%sudo ALL=(ALL) NOPASSWD:/home/${container_user}/${biosdk_local_dir}/install.sh" >> /etc/sudoers \ +&& chown -R ${container_user}:${container_user} /home/${container_user} # select container user for all tasks USER ${container_user_uid}:${container_user_gid} @@ -141,4 +136,4 @@ CMD if [ "$is_glowroot_env" = "present" ]; then \ fi #Sample docker run command: -# sudo docker run --rm -it -e artifactory_url_env="http://artifactory" -e spring_config_label_env="1.0.9" -e active_profile_env="dev" -e spring_config_url_env="http://config-server/config" -e PKCS11_PROXY_SOCKET=tcp://softhsm-ida:5666 -p 8093:8093 authentication-internal-service:1.0.9 \ No newline at end of file +# sudo docker run --rm -it -e artifactory_url_env="http://artifactory" -e spring_config_label_env="1.0.9" -e active_profile_env="dev" -e spring_config_url_env="http://config-server/config" -e PKCS11_PROXY_SOCKET=tcp://softhsm-ida:5666 -p 8093:8093 authentication-internal-service:1.0.9 diff --git a/authentication/authentication-otp-service/Dockerfile b/authentication/authentication-otp-service/Dockerfile index 8744dbba1b6..9ca1b200d36 100644 --- a/authentication/authentication-otp-service/Dockerfile +++ b/authentication/authentication-otp-service/Dockerfile @@ -1,33 +1,36 @@ FROM openjdk:11 -ARG SOURCE -ARG COMMIT_HASH -ARG COMMIT_ID -ARG BUILD_TIME -LABEL source=${SOURCE} -LABEL commit_hash=${COMMIT_HASH} -LABEL commit_id=${COMMIT_ID} -LABEL build_time=${BUILD_TIME} - # 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 +# 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 +# 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 hsm client zip file path #ARG client_zip_path ARG hsm_client_zip_path -# can be passed during Docker build as build time environment for glowroot +# can be passed during Docker build as build time environment for glowroot ARG is_glowroot # can be passed during Docker build as build time environment for artifactory URL ARG artifactory_url +# can be passed during Docker build as build time environment for github branch to pickup configuration from. +ARG container_user=mosip +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} @@ -50,32 +53,18 @@ ENV iam_adapter_url_env=${iam_adapter_url} #ENV zip_file_path=${client_zip_path} ENV hsm_zip_file_path=${hsm_client_zip_path} -#ENV work_dir_env=/ - -# 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 label. +LABEL source=${SOURCE} +LABEL commit_hash=${COMMIT_HASH} +LABEL commit_id=${COMMIT_ID} +LABEL build_time=${BUILD_TIME} -# can be passed during Docker build as build time environment for github branch to pickup configuration from. -ARG container_user_gid=1001 +#ENV work_dir_env=/ ARG hsm_local_dir=hsm-client ENV hsm_local_dir_name=${hsm_local_dir} -# install packages and create user -RUN apt-get -y update \ -&& apt-get install -y unzip sudo \ -&& groupadd -g ${container_user_gid} ${container_user_group} \ -&& useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/sh -m ${container_user} \ -&& adduser ${container_user} sudo \ -&& echo "%sudo ALL=(ALL) NOPASSWD:/home/${container_user}/${hsm_local_dir}/install.sh" >> /etc/sudoers - # set working directory for the user WORKDIR /home/${container_user} @@ -101,8 +90,14 @@ EXPOSE 8092 EXPOSE 9010 -# change permissions of file inside working dir -RUN chown -R ${container_user}:${container_user} /home/${container_user} +## install packages, create user change permissions of file inside working dir +RUN apt-get -y update \ +&& apt-get install -y unzip sudo \ +&& groupadd -g ${container_user_gid} ${container_user_group} \ +&& useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/sh -m ${container_user} \ +&& adduser ${container_user} sudo \ +&& echo "%sudo ALL=(ALL) NOPASSWD:/home/${container_user}/${hsm_local_dir}/install.sh" >> /etc/sudoers \ +&& chown -R ${container_user}:${container_user} /home/${container_user} # select container user for all tasks USER ${container_user_uid}:${container_user_gid} @@ -122,4 +117,4 @@ CMD if [ "$is_glowroot_env" = "present" ]; then \ fi #Sample docker run command: -# sudo docker run --rm -it -e artifactory_url_env="http://artifactory" -e spring_config_label_env="1.0.9" -e active_profile_env="dev" -e spring_config_url_env="http://config-server/config" -e PKCS11_PROXY_SOCKET=tcp://softhsm-ida:5666 -p 8092:8092 authentication-otp-service:1.0.9 \ No newline at end of file +# sudo docker run --rm -it -e artifactory_url_env="http://artifactory" -e spring_config_label_env="1.0.9" -e active_profile_env="dev" -e spring_config_url_env="http://config-server/config" -e PKCS11_PROXY_SOCKET=tcp://softhsm-ida:5666 -p 8092:8092 authentication-otp-service:1.0.9 diff --git a/authentication/authentication-service/Dockerfile b/authentication/authentication-service/Dockerfile index 805fd9b3a84..30828602bce 100644 --- a/authentication/authentication-service/Dockerfile +++ b/authentication/authentication-service/Dockerfile @@ -1,21 +1,12 @@ FROM openjdk:11 -ARG SOURCE -ARG COMMIT_HASH -ARG COMMIT_ID -ARG BUILD_TIME -LABEL source=${SOURCE} -LABEL commit_hash=${COMMIT_HASH} -LABEL commit_id=${COMMIT_ID} -LABEL build_time=${BUILD_TIME} - # 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 +# 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 +# can be passed during Docker build as build time environment for config server URL ARG spring_config_url #ARG bio_sdk_folder=mock/0.9 @@ -27,12 +18,30 @@ ARG demosdk_zip_path #ARG client_zip_path ARG hsm_client_zip_path -# can be passed during Docker build as build time environment for glowroot +# can be passed during Docker build as build time environment for glowroot ARG is_glowroot # can be passed during Docker build as build time environment for artifactory URL ARG artifactory_url +# can be passed during Docker build as build time environment for github branch to pickup configuration from. +ARG container_user=mosip +ARG container_user_group=mosip +ARG container_user_uid=1001 +ARG container_user_gid=1001 + +ARG hsm_local_dir=hsm-client + +ARG biosdk_local_dir=biosdk-client + +ARG demosdk_local_dir=demosdk + +# 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} @@ -63,38 +72,17 @@ ENV hsm_zip_file_path=${hsm_client_zip_path} #ENV work_dir_env=/ -# 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 - -ARG hsm_local_dir=hsm-client - ENV hsm_local_dir_name=${hsm_local_dir} -ARG biosdk_local_dir=biosdk-client - -ARG demosdk_local_dir=demosdk - ENV biosdk_local_dir_name=${biosdk_local_dir} ENV demosdk_local_dir_name=${demosdk_local_dir} -# install packages and create user -RUN apt-get -y update \ -&& apt-get install -y unzip sudo \ -&& groupadd -g ${container_user_gid} ${container_user_group} \ -&& useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/sh -m ${container_user} \ -&& adduser ${container_user} sudo \ -&& echo "%sudo ALL=(ALL) NOPASSWD:/home/${container_user}/${hsm_local_dir}/install.sh" >> /etc/sudoers \ -&& echo "%sudo ALL=(ALL) NOPASSWD:/home/${container_user}/${biosdk_local_dir}/install.sh" >> /etc/sudoers +# 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} # set working directory for the user WORKDIR /home/${container_user} @@ -121,8 +109,16 @@ EXPOSE 8090 EXPOSE 9010 -# change permissions of file inside working dir -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 sudo \ +&& groupadd -g ${container_user_gid} ${container_user_group} \ +&& useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/sh -m ${container_user} \ +&& adduser ${container_user} sudo \ +&& echo "%sudo ALL=(ALL) NOPASSWD:/home/${container_user}/${hsm_local_dir}/install.sh" >> /etc/sudoers \ +&& echo "%sudo ALL=(ALL) NOPASSWD:/home/${container_user}/${biosdk_local_dir}/install.sh" >> /etc/sudoers \ +&& chown -R ${container_user}:${container_user} /home/${container_user} # select container user for all tasks USER ${container_user_uid}:${container_user_gid} @@ -144,4 +140,4 @@ CMD if [ "$is_glowroot_env" = "present" ]; then \ fi #Sample docker run command: -# sudo docker run --rm -it -e artifactory_url_env="http://artifactory" -e spring_config_label_env="1.0.9" -e active_profile_env="dev" -e spring_config_url_env="http://config-server/config" -e PKCS11_PROXY_SOCKET=tcp://softhsm-ida:5666 -p 8090:8090 authentication-service:1.0.9 \ No newline at end of file +# sudo docker run --rm -it -e artifactory_url_env="http://artifactory" -e spring_config_label_env="1.0.9" -e active_profile_env="dev" -e spring_config_url_env="http://config-server/config" -e PKCS11_PROXY_SOCKET=tcp://softhsm-ida:5666 -p 8090:8090 authentication-service:1.0.9