diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 00000000..f99697fa
--- /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=docker -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 4ba90a51..483cc486 100644
--- a/pom.xml
+++ b/pom.xml
@@ -56,22 +56,21 @@
org.springframework.boot
spring-boot-starter-aop
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+ org.springframework.boot
+ spring-boot-starter-logging
+
+
+
co.elastic.logging
logback-ecs-encoder
1.3.2
-
-
- org.slf4j
- slf4j-api
- ${slf4j.version}
-
-
- org.slf4j
- slf4j-simple
- ${slf4j.version}
-
org.springdoc
@@ -477,6 +476,18 @@
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ 3.2.2
+
+
+
+ repackage
+
+
+
+
diff --git a/src/main/environment/common_ci.properties b/src/main/environment/common_ci.properties
index 9efdc9a0..1f9ad128 100644
--- a/src/main/environment/common_ci.properties
+++ b/src/main/environment/common_ci.properties
@@ -66,7 +66,7 @@ oncoWL=7
tcSpeclistWL=7
### Redis IP
-spring.redis.host=localhost
+spring.redis.host=@env.REDIS_HOST@
jwt.secret=@env.JWT_SECRET_KEY@
@@ -76,4 +76,3 @@ logging.file.name=@env.TM_API_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_docker.properties b/src/main/environment/common_docker.properties
new file mode 100644
index 00000000..6316cb8f
--- /dev/null
+++ b/src/main/environment/common_docker.properties
@@ -0,0 +1,76 @@
+ # local env
+# DB Connections
+spring.datasource.url=${DATABASE_URL}
+spring.datasource.username=${DATABASE_USERNAME}
+spring.datasource.password=${DATABASE_PASSWORD}
+spring.datasource.driver-class-name=com.mysql.jdbc.Driver
+
+## Carestream URLs
+carestreamOrderCreateURL=${COMMON_API}/carestream/createOrder
+
+## Identity - Common URLs
+# Registration
+registrationUrl=${COMMON_API}/beneficiary/create
+
+registrarQuickSearchByIdUrl=${COMMON_API}/beneficiary/searchUserByID
+
+registrarQuickSearchByPhoneNoUrl=${COMMON_API}/beneficiary/searchUserByPhone
+
+getBenImageFromIdentity=${IDENTITY_API}/id/benImageByBenRegID
+
+## beneficiary edit
+beneficiaryEditUrl=${COMMON_API}/beneficiary/update
+
+## Advance Search
+registrarAdvanceSearchUrl=${COMMON_API}/beneficiary/searchBeneficiary
+
+## Data Sync API
+dataSyncUploadUrl=${MMU_API}/dataSync/van-to-server
+
+## Data download API
+dataSyncDownloadUrl=${MMU_API}/dataSync/server-to-van
+
+## TC specialist slot booking
+tcSpecialistSlotBook=${SCHEDULER_API}/schedule/bookSlot
+
+## TC specialist slot cancelling
+tcSpecialistSlotCancel=${SCHEDULER_API}/schedule/cancelBookedSlot
+
+## TM sms to beneficiary(schedule, cancel, reschedule)
+sendSMSUrl=${COMMON_API}/sms/sendSMS
+
+### get openkm doc download url
+openkmDocUrl=${COMMON_API}/kmfilemanager/getKMFileDownloadURL
+
+## Fetosense Url
+fetosense-api-url-ANCTestDetails=https://asia-south1-amrit-fetosense.cloudfunctions.net/insertMother
+
+## apiKey for calling fetosense api
+fetosenseAPIKey=${FETOSENSE_API_KEY}
+
+## TM SMS template details(SMS type)
+schedule=TC Schedule SMS
+cancel=TC Cancel SMS
+reSchedule=TC Reschedule SMS
+
+snomedCTPageSize=10
+prescription=TMPrescription SMS
+
+nurseWL=7
+nurseTCWL=7
+docWL=7
+pharmaWL=7
+labWL=7
+radioWL=7
+oncoWL=7
+tcSpeclistWL=7
+
+### Redis IP
+spring.redis.host=${REDIS_HOST}
+jwt.secret=${JWT_SECRET_KEY}
+
+#ELK logging file name
+logging.file.name=${TM_API_LOGGING_FILE_NAME}
+
+springdoc.api-docs.enabled=${SWAGGER_DOC_ENABLED}
+springdoc.swagger-ui.enabled=${SWAGGER_DOC_ENABLED}
diff --git a/src/main/java/com/iemr/tm/utils/JwtAuthenticationUtil.java b/src/main/java/com/iemr/tm/utils/JwtAuthenticationUtil.java
index 0a59bba6..cd32bea1 100644
--- a/src/main/java/com/iemr/tm/utils/JwtAuthenticationUtil.java
+++ b/src/main/java/com/iemr/tm/utils/JwtAuthenticationUtil.java
@@ -112,16 +112,22 @@ private Users fetchUserFromDB(String userId) {
Users user = userLoginRepo.getUserByUserID(Long.parseLong(userId));
if (user != null) {
- // Cache the user in Redis for future requests (cache for 30 minutes)
- redisTemplate.opsForValue().set(redisKey, user, 30, TimeUnit.MINUTES);
+ Users userHash = new Users();
+ userHash.setUserID(user.getUserID());
+ userHash.setUserName(user.getUserName());
+
+ // Cache the minimal user in Redis for future requests (cache for 30 minutes)
+ redisTemplate.opsForValue().set(redisKey, userHash, 30, TimeUnit.MINUTES);
// Log that the user has been stored in Redis
logger.info("User stored in Redis with key: " + redisKey);
+
+ return user;
} else {
logger.warn("User not found for userId: " + userId);
}
- return user;
+ return null;
}
}
diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml
index 50aecbc8..af1e0109 100644
--- a/src/main/resources/logback-spring.xml
+++ b/src/main/resources/logback-spring.xml
@@ -1,6 +1,6 @@
+ value="${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}}/tm-api}" />