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
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# --- 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

# Run the application
ENTRYPOINT ["java", "-jar", "app.war"]
33 changes: 23 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@
<version>3.2.2</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>co.elastic.logging</groupId>
<artifactId>logback-ecs-encoder</artifactId>
Expand All @@ -43,16 +54,6 @@

<!--<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-log4j2</artifactId>
<version>3.2.2</version> </dependency> -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.1.0-alpha1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.1.0-alpha1</version>
</dependency>
<!-- Swagger -->
<dependency>
<groupId>org.springdoc</groupId>
Expand Down Expand Up @@ -409,6 +410,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
1 change: 1 addition & 0 deletions src/main/environment/ecd_ci.properties
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ logging.file.name=@env.ECD_API_LOGGING_FILE_NAME@
springdoc.api-docs.enabled=@env.SWAGGER_DOC_ENABLED@
springdoc.swagger-ui.enabled=@env.SWAGGER_DOC_ENABLED@

spring.redis.host=@env.REDIS_HOST@
28 changes: 28 additions & 0 deletions src/main/environment/ecd_docker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 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

# Secondary DB
secondary.datasource.username=${REPORTING_DATABASE_USERNAME}
secondary.datasource.password=${REPORTING_DATABASE_PASSWORD}
secondary.datasource.url=${REPORTING_DATABASE_URL}
secondary.datasource.driver-class-name=com.mysql.jdbc.Driver

# API URLs
registerBeneficiaryUrl=${COMMON_API}/beneficiary/create
beneficiaryEditUrl=${COMMON_API}/beneficiary/update

# JWT Configuration
jwt.secret=${JWT_SECRET_KEY}

# ELK Logging
logging.path=logs/
logging.file.name=${ECD_API_LOGGING_FILE_NAME}

# Swagger Documentation
springdoc.api-docs.enabled=${SWAGGER_DOC_ENABLED}
springdoc.swagger-ui.enabled=${SWAGGER_DOC_ENABLED}

spring.redis.host=${REDIS_HOST}
1 change: 0 additions & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ spring.http.multipart.max-file-size=10MB
spring.jackson.serialization.fail-on-empty-beans=false

spring.session.store-type=redis
spring.redis.host=localhost
spring.redis.port=6379

iemr.session.expiry.time.sec=7200
Expand Down
Loading