Skip to content

Commit

Permalink
[MOSIP-33145] Merge to develop from develop-java21
Browse files Browse the repository at this point in the history
Signed-off-by: JanardhanBS-SyncByte <janardhan@syncbyte.in>
  • Loading branch information
JanardhanBS-SyncByte committed Jun 18, 2024
2 parents 8f85f87 + c6a9bbb commit 7cbb2a2
Show file tree
Hide file tree
Showing 39 changed files with 3,447 additions and 1,098 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/push-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ on:
- release*
- master
- 1.*
- develop
- develop*
- MOSIP*

jobs:
build-biosdk-services:
uses: mosip/kattu/.github/workflows/maven-build.yml@master
uses: mosip/kattu/.github/workflows/maven-build.yml@master-java21
with:
SERVICE_LOCATION: ./biosdk-services
BUILD_ARTIFACT: biosdk-services
Expand All @@ -35,13 +35,13 @@ jobs:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

publish_to_nexus:
if: "${{ !contains(github.ref, 'master') && github.event_name != 'pull_request' }}"
if: "${{ !contains(github.ref, 'master') && github.event_name != 'pull_request' && github.event_name != 'release' && github.event_name != 'prerelease' && github.event_name != 'publish' }}"
needs: build-biosdk-services
uses: mosip/kattu/.github/workflows/maven-publish-to-nexus.yml@master
uses: mosip/kattu/.github/workflows/maven-publish-to-nexus.yml@master-java21
with:
SERVICE_LOCATION: ./biosdk-services
secrets:
OSSRH_URL: ${{ secrets.RELEASE_URL }}
OSSRH_URL: ${{ secrets.OSSRH_SNAPSHOT_URL }}
OSSRH_USER: ${{ secrets.OSSRH_USER }}
OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
Expand All @@ -51,7 +51,7 @@ jobs:
sonar_analysis:
needs: build-biosdk-services
if: "${{ github.event_name != 'pull_request' }}"
uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master
uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master-java21
with:
SERVICE_LOCATION: ./biosdk-services
secrets:
Expand All @@ -72,7 +72,7 @@ jobs:
SERVICE_NAME: 'biosdk-server'
BUILD_ARTIFACT: 'biosdk-services'
fail-fast: false
uses: mosip/kattu/.github/workflows/docker-build.yml@master
uses: mosip/kattu/.github/workflows/docker-build.yml@master-java21
name: ${{ matrix.SERVICE_NAME }}
with:
SERVICE_LOCATION: ${{ matrix.SERVICE_LOCATION }}
Expand Down
17 changes: 16 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
.idea
*/target*
*/logs
*/logs
<<<<<<< HEAD
.metadata/
.sonarlint/
*/.classpath
*/.project
*/.settings/
*/lib/
=======
../.metadata/
../.sonarlint/
.classpath
.project
.settings/
lib/
>>>>>>> 4b78bb010ab198e4a5e09246e21840b55a5cf30b
96 changes: 96 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
FROM mosipdev/openjdk-21-jre:latest

# label to be assigned along with Docker build [Mandatory]
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
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 github branch to pickup configuration from, at docker runtime
ENV spring_config_label_env=${spring_config_label}
# environment variable to pass active profile such as DEV, QA etc at docker runtime
ENV active_profile_env=${active_profile}
# environment variable to pass spring configuration url, at docker runtime
ENV spring_config_url_env=${spring_config_url}

ARG biosdk_zip_url

ENV biosdk_zip_file_path=${biosdk_zip_url}

ARG biosdk_local_dir=biosdk-client

ENV biosdk_local_dir_name=${biosdk_local_dir}

ARG sdk_impl

ARG service_context=/biosdk-service

ENV service_context_env=${service_context}

#ENV biosdk_zip_url=$biosdk_zip_url
ENV biosdk_bioapi_impl=${sdk_impl}

# 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

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

ENV work_dir=/home/${container_user}

ARG loader_path=${work_dir}/additional_jars/

ENV loader_path_env=${loader_path}

ARG logging_level_root=INFO

ENV logging_level_root_env=${logging_level_root}

# install packages and create user for ubunutu latest
RUN apt-get update && \
apt-get install -y --no-install-recommends sudo && \
groupadd -g ${container_user_gid} ${container_user_group} && \
useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/bash -m ${container_user} && \
mkdir -p /home/${container_user} ${loader_path}


ADD configure_biosdk.sh /home/${container_user}/configure_biosdk.sh

ADD ./target/biosdk-services-*.jar biosdk-services.jar

RUN chmod +x /home/${container_user}/configure_biosdk.sh \
&& chmod a-w /home/${container_user}/configure_biosdk.sh \
&& chmod 775 biosdk-services.jar \
&& chown -R ${container_user}:${container_user} /home/${container_user}

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

EXPOSE 9099

ENTRYPOINT ["./configure_biosdk.sh"]

CMD echo $biosdk_bioapi_impl ; \
java -Dloader.path="${loader_path_env}" -Dserver.servlet.context-path="${service_context_env}" -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" --add-modules=ALL-SYSTEM --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang.stream=ALL-UNNAMED --add-opens java.base/java.time=ALL-UNNAMED --add-opens java.base/java.time.LocalDate=ALL-UNNAMED --add-opens java.base/java.time.LocalDateTime=ALL-UNNAMED --add-opens java.base/java.time.LocalDateTime.date=ALL-UNNAMED --add-opens java.base/jdk.internal.reflect.DirectMethodHandleAccessor=ALL-UNNAMED -jar biosdk-services.jar
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
[![Maven Package upon a push](https://github.com/mosip/biosdk-services/actions/workflows/push-trigger.yml/badge.svg?branch=master)](https://github.com/mosip/biosdk-services/actions/workflows/push-trigger.yml)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?branch=master&project=mosip_biosdk-services&metric=alert_status)](https://sonarcloud.io/dashboard?branch=master&id=mosip_biosdk-services)

[![Maven Package upon a push](https://github.com/mosip/biosdk-services/actions/workflows/push_trigger.yml/badge.svg?branch=develop-java21)](https://github.com/mosip/biosdk-services/actions/workflows/push_trigger.yml)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?branch=develop-java21&project=mosip_biosdk-services&metric=alert_status)](https://sonarcloud.io/dashboard?branch=develop-java21&id=mosip_biosdk-services)

# Bio-SDK Service

## Overview
This is reference service and provides a mock implementation of Bio-SDK REST Service. By default loads [Mock BIO SDK](https://github.com/mosip/mosip-mock-services/tree/master/mock-sdk) internally on the startup and exposes the endpoints to perform 1:1 match, extraction as per the [IBioAPI](https://github.com/mosip/commons/blob/master/kernel/kernel-biometrics-api/src/main/java/io/mosip/kernel/biometrics/spi/IBioApi.java).
This is reference service and provides a mock implementation of Bio-SDK REST Service. By default loads [Mock BIO SDK](https://github.com/mosip/mosip-mock-services/tree/master/mock-sdk) internally on the startup and exposes the endpoints to perform 1:1 match, extraction as per the [IBioAPIV2](https://github.com/mosip/commons/blob/master/kernel/kernel-biometrics-api/src/main/java/io/mosip/kernel/biometrics/spi/IBioApiV2.java).

To know more about Biometric SDK, refer [biometric-sdk](https://docs.mosip.io/1.2.0/biometrics/biometric-sdk).

Expand Down
155 changes: 137 additions & 18 deletions biosdk-services/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,124 @@
FROM openjdk:11
<<<<<<< HEAD
FROM openjdk:11

# 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

# 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 application name
ARG spring_application_name

# can be passed during Docker build as build time environment for config name
ARG spring_cloud_config_name

# can be passed during Docker build as build time environment for context path
ARG server_servlet_context

# environment variable to pass github branch to pickup configuration from, at docker runtime
ENV spring_config_label_env=${spring_config_label}

# environment variable to pass active profile such as DEV, QA etc at docker runtime
ENV active_profile_env=${active_profile}

# environment variable to pass spring configuration url, at docker runtime
ENV spring_config_url_env=${spring_config_url}

# environment variable to pass spring application name, at docker runtime
ENV spring_application_name_env=${spring_application_name}

# environment variable to pass spring config name, at docker runtime
ENV spring_cloud_config_name_env=${spring_cloud_config_name}

# environment variable to pass spring context path , at docker runtime
ENV server_servlet_context_env=${server_servlet_context}

ARG biosdk_zip_url

ENV biosdk_zip_file_path=${biosdk_zip_url}

ARG biosdk_local_dir=biosdk-client

ENV biosdk_local_dir_name=${biosdk_local_dir}

ARG sdk_impl

ARG service_context=/biosdk-service

ENV service_context_env=${service_context}

#ENV biosdk_zip_url=$biosdk_zip_url
ENV biosdk_bioapi_impl=${sdk_impl}

# 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
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}

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

ENV work_dir=/home/${container_user}

ARG loader_path=${work_dir}/additional_jars/

RUN mkdir -p ${loader_path}

ENV loader_path_env=${loader_path}

ARG logging_level_root=INFO

ENV logging_level_root_env=${logging_level_root}

ADD ./target/biosdk-services-*.jar biosdk-services.jar

ADD ./configure_biosdk.sh configure_biosdk.sh

RUN chmod 775 biosdk-services.jar

RUN chmod +x configure_biosdk.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}

EXPOSE 9099

ENTRYPOINT [ "./configure_biosdk.sh" ]

CMD echo $biosdk_bioapi_impl ; \
java -Dloader.path="${loader_path_env}" -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" -jar biosdk-services.jar
=======
FROM mosipdev/openjdk-21-jre:latest

# label to be assigned along with Docker build [Mandatory]
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
Expand Down Expand Up @@ -45,44 +165,43 @@ 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
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}

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

ENV work_dir=/home/${container_user}

ARG loader_path=${work_dir}/additional_jars/

RUN mkdir -p ${loader_path}

ENV loader_path_env=${loader_path}

ARG logging_level_root=INFO

ENV logging_level_root_env=${logging_level_root}

ADD ./target/biosdk-services-*.jar biosdk-services.jar
# install packages and create user for ubunutu latest
RUN apt-get update && \
apt-get install -y --no-install-recommends sudo && \
groupadd -g ${container_user_gid} ${container_user_group} && \
useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/bash -m ${container_user} && \
mkdir -p /home/${container_user} ${loader_path}


ADD ./configure_biosdk.sh configure_biosdk.sh
ADD configure_biosdk.sh /home/${container_user}/configure_biosdk.sh

RUN chmod 775 biosdk-services.jar

RUN chmod +x configure_biosdk.sh
ADD ./target/biosdk-services-*.jar biosdk-services.jar

# change permissions of file inside working dir
RUN chown -R ${container_user}:${container_user} /home/${container_user}
RUN chmod +x /home/${container_user}/configure_biosdk.sh \
&& chmod a-w /home/${container_user}/configure_biosdk.sh \
&& chmod 775 biosdk-services.jar \
&& chown -R ${container_user}:${container_user} /home/${container_user}

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

EXPOSE 9099

ENTRYPOINT [ "./configure_biosdk.sh" ]
ENTRYPOINT ["./configure_biosdk.sh"]

CMD echo $biosdk_bioapi_impl ; \
java -Dloader.path="${loader_path_env}" -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" -jar biosdk-services.jar
java -Dloader.path="${loader_path_env}" -Dserver.servlet.context-path="${service_context_env}" -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" --add-modules=ALL-SYSTEM --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang.stream=ALL-UNNAMED --add-opens java.base/java.time=ALL-UNNAMED --add-opens java.base/java.time.LocalDate=ALL-UNNAMED --add-opens java.base/java.time.LocalDateTime=ALL-UNNAMED --add-opens java.base/java.time.LocalDateTime.date=ALL-UNNAMED --add-opens java.base/jdk.internal.reflect.DirectMethodHandleAccessor=ALL-UNNAMED -jar biosdk-services.jar
>>>>>>> 4b78bb010ab198e4a5e09246e21840b55a5cf30b
Loading

0 comments on commit 7cbb2a2

Please sign in to comment.