Skip to content

Commit b58c191

Browse files
Copy env variables to new docker properties for deploying in Linux/Docker (#88)
* feat: add Dockerfile and update pom.xml plugin for repackage * chore: update Dockerfile, pom.xml and CI properties; add docker properties file * fix: add missing TM and FHIR APIS --------- Co-authored-by: Suraj <[email protected]> Co-authored-by: Suraj <[email protected]> Co-authored-by: Mithun James <[email protected]>
1 parent ec930c9 commit b58c191

File tree

5 files changed

+122
-14
lines changed

5 files changed

+122
-14
lines changed

Dockerfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# --- Stage 1: Build the application using Maven ---
2+
FROM maven:3.9.6-eclipse-temurin-17 AS build
3+
4+
WORKDIR /app
5+
6+
COPY . .
7+
8+
# Build the application while caching Maven dependencies to speed up future builds
9+
RUN --mount=type=cache,target=/root/.m2 \
10+
mvn clean package -DENV_VAR=docker -DskipTests -Dgit.skip=true
11+
12+
# --- Stage 2: Run the application with a minimal JRE image ---
13+
FROM eclipse-temurin:17-jre
14+
15+
WORKDIR /app
16+
17+
# Copy the built WAR file from the build stage
18+
COPY --from=build /app/target/*.war app.war
19+
20+
EXPOSE 8080
21+
22+
ENTRYPOINT ["java", "-jar", "app.war"]

pom.xml

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,21 @@
5656
<groupId>org.springframework.boot</groupId>
5757
<artifactId>spring-boot-starter-aop</artifactId>
5858
</dependency>
59+
<dependency>
60+
<groupId>org.springframework.boot</groupId>
61+
<artifactId>spring-boot-starter</artifactId>
62+
<exclusions>
63+
<exclusion>
64+
<groupId>org.springframework.boot</groupId>
65+
<artifactId>spring-boot-starter-logging</artifactId>
66+
</exclusion>
67+
</exclusions>
68+
</dependency>
5969
<dependency>
6070
<groupId>co.elastic.logging</groupId>
6171
<artifactId>logback-ecs-encoder</artifactId>
6272
<version>1.3.2</version>
6373
</dependency>
64-
65-
<dependency>
66-
<groupId>org.slf4j</groupId>
67-
<artifactId>slf4j-api</artifactId>
68-
<version>${slf4j.version}</version>
69-
</dependency>
70-
<dependency>
71-
<groupId>org.slf4j</groupId>
72-
<artifactId>slf4j-simple</artifactId>
73-
<version>${slf4j.version}</version>
74-
</dependency>
7574
<!-- Swagger -->
7675
<dependency>
7776
<groupId>org.springdoc</groupId>
@@ -477,6 +476,18 @@
477476
</execution>
478477
</executions>
479478
</plugin>
479+
<plugin>
480+
<groupId>org.springframework.boot</groupId>
481+
<artifactId>spring-boot-maven-plugin</artifactId>
482+
<version>3.2.2</version>
483+
<executions>
484+
<execution>
485+
<goals>
486+
<goal>repackage</goal>
487+
</goals>
488+
</execution>
489+
</executions>
490+
</plugin>
480491
</plugins>
481492
</build>
482493

src/main/environment/common_ci.properties

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ oncoWL=7
6666
tcSpeclistWL=7
6767

6868
### Redis IP
69-
spring.redis.host=localhost
69+
spring.redis.host=@env.REDIS_HOST@
7070
jwt.secret=@env.JWT_SECRET_KEY@
7171

7272

@@ -76,4 +76,3 @@ [email protected]_API_LOGGING_FILE_NAME@
7676

7777
springdoc.api-docs.enabled=@env.SWAGGER_DOC_ENABLED@
7878
springdoc.swagger-ui.enabled=@env.SWAGGER_DOC_ENABLED@
79-
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# local env
2+
# DB Connections
3+
spring.datasource.url=${DATABASE_URL}
4+
spring.datasource.username=${DATABASE_USERNAME}
5+
spring.datasource.password=${DATABASE_PASSWORD}
6+
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
7+
8+
## Carestream URLs
9+
carestreamOrderCreateURL=${COMMON_API}/carestream/createOrder
10+
11+
## Identity - Common URLs
12+
# Registration
13+
registrationUrl=${COMMON_API}/beneficiary/create
14+
15+
registrarQuickSearchByIdUrl=${COMMON_API}/beneficiary/searchUserByID
16+
17+
registrarQuickSearchByPhoneNoUrl=${COMMON_API}/beneficiary/searchUserByPhone
18+
19+
getBenImageFromIdentity=${IDENTITY_API}/id/benImageByBenRegID
20+
21+
## beneficiary edit
22+
beneficiaryEditUrl=${COMMON_API}/beneficiary/update
23+
24+
## Advance Search
25+
registrarAdvanceSearchUrl=${COMMON_API}/beneficiary/searchBeneficiary
26+
27+
## Data Sync API
28+
dataSyncUploadUrl=${MMU_API}/dataSync/van-to-server
29+
30+
## Data download API
31+
dataSyncDownloadUrl=${MMU_API}/dataSync/server-to-van
32+
33+
## TC specialist slot booking
34+
tcSpecialistSlotBook=${SCHEDULER_API}/schedule/bookSlot
35+
36+
## TC specialist slot cancelling
37+
tcSpecialistSlotCancel=${SCHEDULER_API}/schedule/cancelBookedSlot
38+
39+
## TM sms to beneficiary(schedule, cancel, reschedule)
40+
sendSMSUrl=${COMMON_API}/sms/sendSMS
41+
42+
### get openkm doc download url
43+
openkmDocUrl=${COMMON_API}/kmfilemanager/getKMFileDownloadURL
44+
45+
## Fetosense Url
46+
fetosense-api-url-ANCTestDetails=https://asia-south1-amrit-fetosense.cloudfunctions.net/insertMother
47+
48+
## apiKey for calling fetosense api
49+
fetosenseAPIKey=${FETOSENSE_API_KEY}
50+
51+
## TM SMS template details(SMS type)
52+
schedule=TC Schedule SMS
53+
cancel=TC Cancel SMS
54+
reSchedule=TC Reschedule SMS
55+
56+
snomedCTPageSize=10
57+
prescription=TMPrescription SMS
58+
59+
nurseWL=7
60+
nurseTCWL=7
61+
docWL=7
62+
pharmaWL=7
63+
labWL=7
64+
radioWL=7
65+
oncoWL=7
66+
tcSpeclistWL=7
67+
68+
### Redis IP
69+
spring.redis.host=${REDIS_HOST}
70+
jwt.secret=${JWT_SECRET_KEY}
71+
72+
#ELK logging file name
73+
logging.file.name=${TM_API_LOGGING_FILE_NAME}
74+
75+
springdoc.api-docs.enabled=${SWAGGER_DOC_ENABLED}
76+
springdoc.swagger-ui.enabled=${SWAGGER_DOC_ENABLED}

src/main/resources/logback-spring.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<configuration>
22
<property name="LOG_FILE"
3-
value="${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}}/my-api}" />
3+
value="${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}}/tm-api}" />
44
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
55
<include resource="org/springframework/boot/logging/logback/console-appender.xml" />
66
<appender name="ECS_JSON_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">

0 commit comments

Comments
 (0)