Skip to content

Commit 5f3f2b3

Browse files
Copy env variables to new docker properties for deploying in Linux/Docker (#59)
* feat: add Dockerfile and update pom.xml plugin for repackage * chore: update Dockerfile and add seperate docker properties file * fix: add missing TM and FHIR APIS --------- Co-authored-by: Suraj <suraj.ukumar.p@gmail.com> Co-authored-by: Suraj <123288511+Suraj-kumar00@users.noreply.github.com> Co-authored-by: Mithun James <1007084+drtechie@users.noreply.github.com>
1 parent 7fba020 commit 5f3f2b3

4 files changed

Lines changed: 59 additions & 2 deletions

File tree

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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,18 @@
392392
</execution>
393393
</executions>
394394
</plugin>
395+
<plugin>
396+
<groupId>org.springframework.boot</groupId>
397+
<artifactId>spring-boot-maven-plugin</artifactId>
398+
<version>3.2.2</version>
399+
<executions>
400+
<execution>
401+
<goals>
402+
<goal>repackage</goal>
403+
</goals>
404+
</execution>
405+
</executions>
406+
</plugin>
395407
</plugins>
396408
</build>
397409
<reporting>

src/main/environment/common_ci.properties

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ callcentre-server-ip=@env.CALLCENTRE_SERVER_IP@
1515
common-url=@env.COMMON_API@
1616

1717
### Redis IP
18-
spring.redis.host=localhost
18+
spring.redis.host=@env.REDIS_HOST@
1919
jwt.secret=@env.JWT_SECRET_KEY@
2020

2121
#ELK logging file name
@@ -25,4 +25,3 @@ logging.file.name=@env.SCHEDULER_API_LOGGING_FILE_NAME@
2525
springdoc.api-docs.enabled=@env.SWAGGER_DOC_ENABLED@
2626
springdoc.swagger-ui.enabled=@env.SWAGGER_DOC_ENABLED@
2727

28-
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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.cj.jdbc.Driver
7+
8+
spring.jpa.show-sql=true
9+
10+
spring.profiles.active=test
11+
12+
callcentre-server-ip=${CALLCENTRE_SERVER_IP}
13+
14+
common-url=${COMMON_API}
15+
16+
### Redis IP
17+
spring.redis.host=${REDIS_HOST}
18+
jwt.secret=${JWT_SECRET_KEY}
19+
20+
#ELK logging file name
21+
logging.file.name=${SCHEDULER_API_LOGGING_FILE_NAME}
22+
23+
springdoc.api-docs.enabled=${SWAGGER_DOC_ENABLED}
24+
springdoc.swagger-ui.enabled=${SWAGGER_DOC_ENABLED}

0 commit comments

Comments
 (0)