Skip to content

Commit

Permalink
[MOSIP-31031] Added method to fetch docker hash ID
Browse files Browse the repository at this point in the history
Signed-off-by: syed salman <[email protected]>
  • Loading branch information
syedsalman3753 committed Jan 30, 2024
1 parent b2682e6 commit 76c9c8e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
8 changes: 6 additions & 2 deletions pmptest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,15 @@ ARG container_user_gid=1001
# Set working directory for the user
ENV work_dir=/home/${container_user}/

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/
# Switch to the specified user for the subsequent commands
USER ${container_user_uid}:${container_user_gid}

Expand Down
8 changes: 8 additions & 0 deletions pmptest/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
#!/bin/bash

sleep 5
export DOCKER_HASH_ID=$( kubectl get pod "$HOSTNAME" -n "$NS" -o jsonpath='{.status.containerStatuses[*].imageID}' | sed 's/ /\n/g' | grep -v 'istio' | sed 's/docker\-pullable\:\/\///g' )
if [[ -z $DOCKER_HASH_ID ]]; then
echo "DOCKER_HASH_ID IS EMPTY;EXITING";
exit 1;
fi
echo "DOCKER_HASH_ID ; $DOCKER_HASH_ID"

java --version
java -jar pmpui-*-jar-with-dependencies.jar

0 comments on commit 76c9c8e

Please sign in to comment.