Skip to content

Commit

Permalink
MOSIP-32461 docker changes
Browse files Browse the repository at this point in the history
Signed-off-by: Sowmya Ujjappa Banakar <[email protected]>
  • Loading branch information
Sowmya Ujjappa Banakar committed May 29, 2024
1 parent 862c836 commit aef11d8
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 45 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM eclipse-temurin:21-jre-alpine
FROM mosipdev/openjdk-21-jre:latest

ARG SOURCE
ARG COMMIT_HASH
Expand Down Expand Up @@ -49,7 +49,7 @@ ARG container_user=mosip
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=1002
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
Expand All @@ -64,41 +64,36 @@ ENV biosdk_local_dir_name=${biosdk_local_dir}
#ENV bio_sdk_folder_env=${bio_sdk_folder}
ENV biosdk_zip_file_path=${biosdk_zip_path}

# install packages and create user
RUN apk -q update \
&& apk add -q unzip sudo \
&& addgroup -g ${container_user_gid} ${container_user_group} \
&& adduser -s /bin/sh -u ${container_user_uid} -G ${container_user_group} -h /home/${container_user} --disabled-password ${container_user} \
&& addgroup sudo \
&& adduser ${container_user} sudo \
&& echo "%sudo ALL=(ALL) NOPASSWD:/home/${container_user}/${biosdk_local_dir}/install.sh" >> /etc/sudoers
ARG stage_group_name=registration-processor-stage-group-2

# set working directory for the user
WORKDIR /home/${container_user}
ENV group_name=${stage_group_name}

ENV work_dir=/home/${container_user}

ARG loader_path=${work_dir}/additional_jars/

RUN mkdir -p ${loader_path}

ENV loader_path_env=${loader_path}

# change volume to whichever storage directory you want to use for this container.
#VOLUME /home/logs

ARG stage_group_name=registration-processor-stage-group-2

ENV group_name=${stage_group_name}
# set working directory for the user
WORKDIR ${work_dir}

ADD ./target/${group_name}-*.jar ${group_name}.jar

ADD configure_start.sh configure_start.sh

RUN chmod +x configure_start.sh
# 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/bash -m ${container_user} \
&& adduser ${container_user} sudo \
&& echo "%sudo ALL=(ALL) NOPASSWD:/home/${container_user}/${biosdk_local_dir}/install.sh" >> /etc/sudoers \
&& mkdir -p ${loader_path} \
&& chmod +x configure_start.sh \
&& chown -R ${container_user}:${container_user} ${work_dir}

# change permissions of file inside working dir
RUN chown -R ${container_user}:${container_user} /home/${container_user}
# change volume to whichever storage directory you want to use for this container.
#VOLUME /home/logs

# select container user for all tasks
USER ${container_user_uid}:${container_user_gid}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM eclipse-temurin:21-jre-alpine
FROM mosipdev/openjdk-21-jre:latest

ARG SOURCE
ARG COMMIT_HASH
Expand Down Expand Up @@ -64,41 +64,36 @@ ENV biosdk_local_dir_name=${biosdk_local_dir}
#ENV bio_sdk_folder_env=${bio_sdk_folder}
ENV biosdk_zip_file_path=${biosdk_zip_path}

# install packages and create user
RUN apk -q update \
&& apk add -q unzip sudo \
&& addgroup -g ${container_user_gid} ${container_user_group} \
&& adduser -s /bin/sh -u ${container_user_uid} -G ${container_user_group} -h /home/${container_user} --disabled-password ${container_user} \
&& addgroup sudo \
&& adduser ${container_user} sudo \
&& echo "%sudo ALL=(ALL) NOPASSWD:/home/${container_user}/${biosdk_local_dir}/install.sh" >> /etc/sudoers
ARG stage_group_name=registration-processor-stage-group-4

# set working directory for the user
WORKDIR /home/${container_user}
ENV group_name=${stage_group_name}

ENV work_dir=/home/${container_user}

ARG loader_path=${work_dir}/additional_jars/

RUN mkdir -p ${loader_path}

ENV loader_path_env=${loader_path}

# change volume to whichever storage directory you want to use for this container.
#VOLUME /home/logs

ARG stage_group_name=registration-processor-stage-group-4

ENV group_name=${stage_group_name}
# set working directory for the user
WORKDIR ${work_dir}

ADD ./target/${group_name}-*.jar ${group_name}.jar

ADD configure_start.sh configure_start.sh

RUN chmod +x configure_start.sh
# 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/bash -m ${container_user} \
&& adduser ${container_user} sudo \
&& echo "%sudo ALL=(ALL) NOPASSWD:/home/${container_user}/${biosdk_local_dir}/install.sh" >> /etc/sudoers \
&& mkdir -p ${loader_path} \
&& chmod +x configure_start.sh \
&& chown -R ${container_user}:${container_user} ${work_dir}

# change permissions of file inside working dir
RUN chown -R ${container_user}:${container_user} /home/${container_user}
# change volume to whichever storage directory you want to use for this container.
#VOLUME /home/logs

# select container user for all tasks
USER ${container_user_uid}:${container_user_gid}
Expand Down

0 comments on commit aef11d8

Please sign in to comment.