Skip to content

Commit f708b76

Browse files
Copy env variables to new docker properties for deploying in Linux/Docker (#85)
* build: Dockerize admin UI application * fix: update the port as tomcat runs on 8080 * chore: update Dockerfile, env example, log config; update .gitignore * chore: clean up env file, update Dockerfile and build config * feat: add seperate env properties for docker build * Delete logs/admin-api.log.json * fix: delete unnecessary logs * fix: move redis host to env variable * fix: move redis host to env variable * fix: common API URL * fix: add logging path --------- Co-authored-by: Suraj <suraj.ukumar.p@gmail.com> Co-authored-by: Mithun James <1007084+drtechie@users.noreply.github.com>
1 parent b319fb6 commit f708b76

5 files changed

Lines changed: 63 additions & 3 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ target/
1515
*.iml
1616
*.ipr
1717

18+
### environment ###
19+
.env
20+
1821
### NetBeans ###
1922
nbproject/private/
2023
build/

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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,18 @@
462462
</execution>
463463
</executions>
464464
</plugin>
465-
465+
<plugin>
466+
<groupId>org.springframework.boot</groupId>
467+
<artifactId>spring-boot-maven-plugin</artifactId>
468+
<version>3.2.2</version>
469+
<executions>
470+
<execution>
471+
<goals>
472+
<goal>repackage</goal>
473+
</goals>
474+
</execution>
475+
</executions>
476+
</plugin>
466477
</plugins>
467478
</build>
468479
<reporting>

src/main/environment/admin_ci.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ videoConsultation-base-url=@env.SWYMED_BASE_URL@
1313

1414

1515
### Redis IP
16-
spring.redis.host=localhost
16+
spring.redis.host=@env.REDIS_HOST@
1717
spring.main.allow-bean-definition-overriding=true
1818
jwt.secret=@env.JWT_SECRET_KEY@
1919
#ELK logging file name
@@ -23,4 +23,4 @@ logging.file.name=@env.ADMIN_API_LOGGING_FILE_NAME@
2323
common-url=@env.COMMON_API@
2424

2525
springdoc.api-docs.enabled=@env.SWAGGER_DOC_ENABLED@
26-
springdoc.swagger-ui.enabled=@env.SWAGGER_DOC_ENABLED@
26+
springdoc.swagger-ui.enabled=@env.SWAGGER_DOC_ENABLED@
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+
callcentre-server-ip=${CALLCENTRE_SERVER_IP}
9+
10+
videoConsultation-apikey=${SWYMED_APIKEY}
11+
videoConsultation-base-url=${SWYMED_BASE_URL}
12+
13+
### Redis IP
14+
spring.redis.host=${REDIS_HOST}
15+
spring.main.allow-bean-definition-overriding=true
16+
jwt.secret=${JWT_SECRET_KEY}
17+
#ELK logging file name
18+
logging.path=logs/
19+
logging.file.name=${ADMIN_API_LOGGING_FILE_NAME}
20+
21+
common-url=${COMMON_API}
22+
23+
springdoc.api-docs.enabled=${SWAGGER_DOC_ENABLED}
24+
springdoc.swagger-ui.enabled=${SWAGGER_DOC_ENABLED}

0 commit comments

Comments
 (0)