Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ target/
*.iml
*.ipr

### environment ###
.env

### NetBeans ###
nbproject/private/
build/
Expand Down
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Comment on lines +18 to +19
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Use explicit artifact name instead of wildcard.
Relying on *.war may catch unintended files. Specify the generated WAR to avoid ambiguity:

-COPY --from=build /app/target/*.war app.war
+COPY --from=build /app/target/${artifactId}-${version}.war app.war

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In Dockerfile lines 18 to 19, replace the wildcard '*.war' in the COPY command
with the explicit name of the generated WAR file to avoid copying unintended
files. Identify the exact WAR filename produced in the build stage and use that
exact name in the COPY --from=build command.

EXPOSE 8080

ENTRYPOINT ["java", "-jar", "app.war"]
13 changes: 12 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,18 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>3.2.2</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
Expand Down
4 changes: 2 additions & 2 deletions src/main/environment/admin_ci.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ videoConsultation-base-url=@env.SWYMED_BASE_URL@


### Redis IP
spring.redis.host=localhost
spring.redis.host=@env.REDIS_HOST@
spring.main.allow-bean-definition-overriding=true
jwt.secret=@env.JWT_SECRET_KEY@
#ELK logging file name
Expand All @@ -23,4 +23,4 @@ logging.file.name=@env.ADMIN_API_LOGGING_FILE_NAME@
common-url=@env.COMMON_API@

springdoc.api-docs.enabled=@env.SWAGGER_DOC_ENABLED@
springdoc.swagger-ui.enabled=@env.SWAGGER_DOC_ENABLED@
springdoc.swagger-ui.enabled=@env.SWAGGER_DOC_ENABLED@
24 changes: 24 additions & 0 deletions src/main/environment/admin_docker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 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.cj.jdbc.Driver

callcentre-server-ip=${CALLCENTRE_SERVER_IP}

videoConsultation-apikey=${SWYMED_APIKEY}
videoConsultation-base-url=${SWYMED_BASE_URL}

### Redis IP
spring.redis.host=${REDIS_HOST}
spring.main.allow-bean-definition-overriding=true
jwt.secret=${JWT_SECRET_KEY}
#ELK logging file name
logging.path=logs/
logging.file.name=${ADMIN_API_LOGGING_FILE_NAME}

common-url=${COMMON_API}

springdoc.api-docs.enabled=${SWAGGER_DOC_ENABLED}
springdoc.swagger-ui.enabled=${SWAGGER_DOC_ENABLED}
Loading