Skip to content

Commit

Permalink
Merge pull request mosip#1521 from abhishek8shankar/develop-java21
Browse files Browse the repository at this point in the history
[DSD-5378] Update Dockerfile
  • Loading branch information
ckm007 authored Jun 6, 2024
2 parents 63afaed + 2121a7e commit b9b59b2
Showing 1 changed file with 29 additions and 32 deletions.
61 changes: 29 additions & 32 deletions kernel/kernel-config-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
FROM eclipse-temurin:21-jre-alpine
FROM eclipse-temurin:21-jre

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 keystore location for encryption
ARG encrypt_keyStore_location

# can be passed during Docker build as build time environment for keystore password for encryption
ARG encrypt_keyStore_password

# can be passed during Docker build as build time environment for keystore alias for encryption
ARG encrypt_keyStore_alias

# can be passed during Docker build as build time environment for keystore secret for encryption
ARG encrypt_keyStore_secret

# can be passed during Docker build as build time environment for github branch to pickup configuration from.
ARG container_user=mosip
Expand All @@ -23,30 +24,16 @@ ARG container_user_uid=1002
# 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
RUN apk -q update \
&& apk add -q unzip wget \
&& 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}
ARG SOURCE
ARG COMMIT_HASH
ARG COMMIT_ID
ARG BUILD_TIME

# set working directory for the user
WORKDIR /home/${container_user}

ENV work_dir=/home/${container_user}


# can be passed during Docker build as build time environment for keystore location for encryption
ARG encrypt_keyStore_location

# can be passed during Docker build as build time environment for keystore password for encryption
ARG encrypt_keyStore_password

# can be passed during Docker build as build time environment for keystore alias for encryption
ARG encrypt_keyStore_alias

# can be passed during Docker build as build time environment for keystore secret for encryption
ARG encrypt_keyStore_secret

# environment variable to pass GIT URL at docker runtime
ENV git_url_env=${git_url}

Expand All @@ -65,21 +52,31 @@ ENV encrypt_keyStore_alias_env=${encrypt_keyStore_alias}
# environment variable to pass encryption keystore secret at docker runtime
ENV encrypt_keyStore_secret_env=${encrypt_keyStore_secret}

LABEL source=${SOURCE}
LABEL commit_hash=${COMMIT_HASH}
LABEL commit_id=${COMMIT_ID}
LABEL build_time=${BUILD_TIME}

# 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 \
# change permissions of file inside working dir
&& chown -R ${container_user}:${container_user} /home/${container_user}

#ADD execute-jar.sh execute-jar.sh

#RUN chmod 777 execute-jar.sh

# change permissions of file inside working dir
RUN chown -R ${container_user}:${container_user} /home/${container_user}

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


COPY ./target/kernel-config-server-*.jar kernel-config-server.jar

EXPOSE 51000

#CMD ./execute-jar.sh
CMD java -jar kernel-config-server.jar

0 comments on commit b9b59b2

Please sign in to comment.