From ada2ad7fd669f1ba6ef5216b0fc260dcdcee7784 Mon Sep 17 00:00:00 2001 From: Suraj Date: Fri, 9 May 2025 16:06:20 +0530 Subject: [PATCH 1/6] feat: add Dockerfile and update pom.xml plugin for repackage --- Dockerfile | 22 ++++++++++++++++++++++ pom.xml | 12 ++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..29e04fd5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +# --- Stage 1: Build the application using Maven --- +FROM maven:3.9.6-eclipse-temurin-17 AS build + +WORKDIR /app + +COPY . . + +# Build the application while caching Maven dependencies to speed up future builds +RUN --mount=type=cache,target=/root/.m2 \ + mvn clean package -DENV_VAR=ci -DskipTests -Dgit.skip=true + +# --- Stage 2: Run the application with a minimal JRE image --- +FROM eclipse-temurin:17-jre + +WORKDIR /app + +# Copy the built WAR file from the build stage +COPY --from=build /app/target/*.war app.war + +EXPOSE 8080 + +ENTRYPOINT ["java", "-jar", "app.war"] diff --git a/pom.xml b/pom.xml index 14df17d3..f52ef378 100644 --- a/pom.xml +++ b/pom.xml @@ -433,6 +433,18 @@ + + org.springframework.boot + spring-boot-maven-plugin + 3.2.2 + + + + repackage + + + + From 7cbfb35396f7ddf611c01eade12297d2df7be396 Mon Sep 17 00:00:00 2001 From: Suraj Date: Tue, 27 May 2025 17:24:27 +0530 Subject: [PATCH 2/6] chore: update Dockerfile and add seperate docker properties file --- Dockerfile | 2 +- src/main/environment/1097_ci.properties | 1 - src/main/environment/common_ci.properties | 2 +- src/main/environment/common_docker.properties | 11 +++++++++++ 4 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 src/main/environment/common_docker.properties diff --git a/Dockerfile b/Dockerfile index 29e04fd5..f99697fa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ COPY . . # Build the application while caching Maven dependencies to speed up future builds RUN --mount=type=cache,target=/root/.m2 \ - mvn clean package -DENV_VAR=ci -DskipTests -Dgit.skip=true + mvn clean package -DENV_VAR=docker -DskipTests -Dgit.skip=true # --- Stage 2: Run the application with a minimal JRE image --- FROM eclipse-temurin:17-jre diff --git a/src/main/environment/1097_ci.properties b/src/main/environment/1097_ci.properties index 667dcd8f..afeceefd 100644 --- a/src/main/environment/1097_ci.properties +++ b/src/main/environment/1097_ci.properties @@ -9,4 +9,3 @@ logging.file.name=@env.IDENTITY_API_1097_LOGGING_FILE_NAME@ springdoc.api-docs.enabled=@env.SWAGGER_DOC_ENABLED@ springdoc.swagger-ui.enabled=@env.SWAGGER_DOC_ENABLED@ - diff --git a/src/main/environment/common_ci.properties b/src/main/environment/common_ci.properties index 32cb2713..2c0207ef 100644 --- a/src/main/environment/common_ci.properties +++ b/src/main/environment/common_ci.properties @@ -8,4 +8,4 @@ spring.datasource.driver-class-name=com.mysql.jdbc.Driver logging.file.name=@env.IDENTITY_API_LOGGING_FILE_NAME@ springdoc.api-docs.enabled=@env.SWAGGER_DOC_ENABLED@ -springdoc.swagger-ui.enabled=@env.SWAGGER_DOC_ENABLED@ +springdoc.swagger-ui.enabled=@env.SWAGGER_DOC_ENABLED@ \ No newline at end of file diff --git a/src/main/environment/common_docker.properties b/src/main/environment/common_docker.properties new file mode 100644 index 00000000..076f0b80 --- /dev/null +++ b/src/main/environment/common_docker.properties @@ -0,0 +1,11 @@ +# DataSource settings: set here your own configurations for the database +spring.datasource.url=${DATABASE_IDENTITY_URL} +spring.datasource.username=${DATABASE_IDENTITY_USERNAME} +spring.datasource.password=${DATABASE_IDENTITY_PASSWORD} +spring.datasource.driver-class-name=com.mysql.jdbc.Driver + +#ELK logging file name +logging.file.name=${IDENTITY_API_LOGGING_FILE_NAME} + +springdoc.api-docs.enabled=${SWAGGER_DOC_ENABLED} +springdoc.swagger-ui.enabled=${SWAGGER_DOC_ENABLED} From aa8154914632a113cd86c9db5d43a2c9661f6a52 Mon Sep 17 00:00:00 2001 From: Mithun James <1007084+drtechie@users.noreply.github.com> Date: Wed, 11 Jun 2025 00:15:38 +0530 Subject: [PATCH 3/6] create docker file for identity 1097 --- src/main/environment/1097_docker.properties | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/main/environment/1097_docker.properties diff --git a/src/main/environment/1097_docker.properties b/src/main/environment/1097_docker.properties new file mode 100644 index 00000000..261d1e0e --- /dev/null +++ b/src/main/environment/1097_docker.properties @@ -0,0 +1,19 @@ +# DataSource settings: set here your own configurations for the database +spring.datasource.url=${DATABASE_1097_IDENTITY_URL} +spring.datasource.username=${DATABASE_IDENTITY_USERNAME} +spring.datasource.password=${DATABASE_IDENTITY_PASSWORD} +spring.datasource.driver-class-name=com.mysql.jdbc.Driver + +#ELK logging file name +logging.path=logs/ +logging.file.name=${IDENTITY_API_1097_LOGGING_FILE_NAME} + +springdoc.api-docs.enabled=${SWAGGER_DOC_ENABLED} +springdoc.swagger-ui.enabled=${SWAGGER_DOC_ENABLED} + +jwt.secret=${JWT_SECRET_KEY} + # TM Config +tm-url=${TM_API} + +# FHIR Config +fhir-url=${FHIR_API} From d9a746f2c4af88e1510ab73cbdd775e1c0db3d32 Mon Sep 17 00:00:00 2001 From: Mithun James <1007084+drtechie@users.noreply.github.com> Date: Tue, 17 Jun 2025 12:24:39 +0530 Subject: [PATCH 4/6] fix: move redis host to env variable --- src/main/environment/1097_ci.properties | 3 +++ src/main/environment/1097_docker.properties | 3 +++ src/main/environment/common_docker.properties | 5 ++++- src/main/environment/common_example.properties | 5 ++++- src/main/resources/application.properties | 1 - 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/environment/1097_ci.properties b/src/main/environment/1097_ci.properties index ea60930f..a2b79037 100644 --- a/src/main/environment/1097_ci.properties +++ b/src/main/environment/1097_ci.properties @@ -18,3 +18,6 @@ tm-url=@TM_API@ # FHIR Config fhir-url=@FHIR_API@ + +# Redis Config +spring.redis.host=@env.REDIS_HOST@ \ No newline at end of file diff --git a/src/main/environment/1097_docker.properties b/src/main/environment/1097_docker.properties index 261d1e0e..5510dfce 100644 --- a/src/main/environment/1097_docker.properties +++ b/src/main/environment/1097_docker.properties @@ -17,3 +17,6 @@ tm-url=${TM_API} # FHIR Config fhir-url=${FHIR_API} + +# Redis Config +spring.redis.host=${REDIS_HOST} \ No newline at end of file diff --git a/src/main/environment/common_docker.properties b/src/main/environment/common_docker.properties index dd6c7e52..7206d6cb 100644 --- a/src/main/environment/common_docker.properties +++ b/src/main/environment/common_docker.properties @@ -11,4 +11,7 @@ logging.file.name=${IDENTITY_API_LOGGING_FILE_NAME} springdoc.api-docs.enabled=${SWAGGER_DOC_ENABLED} springdoc.swagger-ui.enabled=${SWAGGER_DOC_ENABLED} -jwt.secret=${JWT_SECRET_KEY} \ No newline at end of file +jwt.secret=${JWT_SECRET_KEY} + +# Redis Config +spring.redis.host=${REDIS_HOST} \ No newline at end of file diff --git a/src/main/environment/common_example.properties b/src/main/environment/common_example.properties index 79dfeb12..ca58c85c 100644 --- a/src/main/environment/common_example.properties +++ b/src/main/environment/common_example.properties @@ -13,4 +13,7 @@ logging.file.name=logs/identity-api.log tm-url=http://localhost:8089/ # FHIR Config -fhir-url=http://localhost:8093/ \ No newline at end of file +fhir-url=http://localhost:8093/ + +# Redis Config +spring.redis.host=localhost \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 0a0293e6..a0828d00 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -12,7 +12,6 @@ spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQLDialect #Below lines are added for security reasons spring.session.store-type=redis -spring.redis.host=localhost spring.redis.password= spring.redis.port=6379 From 35c8bc9b4728fb101266b6381adf85fab3bf5563 Mon Sep 17 00:00:00 2001 From: Mithun James <1007084+drtechie@users.noreply.github.com> Date: Tue, 17 Jun 2025 12:26:15 +0530 Subject: [PATCH 5/6] fix: move redis host to env variable --- src/main/environment/1097_example.properties | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/environment/1097_example.properties b/src/main/environment/1097_example.properties index 6a7d8b0f..9eeee5c4 100644 --- a/src/main/environment/1097_example.properties +++ b/src/main/environment/1097_example.properties @@ -14,4 +14,7 @@ logging.file.name=logs/1097identity-api.log tm-url=http://localhost:8089/ # FHIR Config -fhir-url=http://localhost:8093/ \ No newline at end of file +fhir-url=http://localhost:8093/ + +# Redis Config +spring.redis.host=localhost \ No newline at end of file From b29cd20e2009a03ffe434d4e0705aa65a9b45afb Mon Sep 17 00:00:00 2001 From: Mithun James <1007084+drtechie@users.noreply.github.com> Date: Tue, 17 Jun 2025 12:27:37 +0530 Subject: [PATCH 6/6] fix: add missing TM and FHIR APIS --- src/main/environment/common_ci.properties | 3 +++ src/main/environment/common_docker.properties | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/src/main/environment/common_ci.properties b/src/main/environment/common_ci.properties index d6b426ef..debf33c4 100644 --- a/src/main/environment/common_ci.properties +++ b/src/main/environment/common_ci.properties @@ -18,3 +18,6 @@ tm-url=@TM_API@ # FHIR Config fhir-url=@FHIR_API@ + +# Redis Config +spring.redis.host=@env.REDIS_HOST@ \ No newline at end of file diff --git a/src/main/environment/common_docker.properties b/src/main/environment/common_docker.properties index 7206d6cb..4409906e 100644 --- a/src/main/environment/common_docker.properties +++ b/src/main/environment/common_docker.properties @@ -13,5 +13,11 @@ springdoc.swagger-ui.enabled=${SWAGGER_DOC_ENABLED} jwt.secret=${JWT_SECRET_KEY} + # TM Config +tm-url=${TM_API} + +# FHIR Config +fhir-url=${FHIR_API} + # Redis Config spring.redis.host=${REDIS_HOST} \ No newline at end of file