diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f99697f --- /dev/null +++ b/Dockerfile @@ -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 + +EXPOSE 8080 + +ENTRYPOINT ["java", "-jar", "app.war"] diff --git a/pom.xml b/pom.xml index c41d078..ffbae09 100644 --- a/pom.xml +++ b/pom.xml @@ -456,6 +456,18 @@ + + org.springframework.boot + spring-boot-maven-plugin + 3.2.2 + + + + repackage + + + + diff --git a/src/main/environment/1097_ci.properties b/src/main/environment/1097_ci.properties index ea60930..a2b7903 100644 --- a/src/main/environment/1097_ci.properties +++ b/src/main/environment/1097_ci.properties @@ -18,3 +18,6 @@ tm-url=@TM_API@ # FHIR Config fhir-url=@FHIR_API@ + +# Redis Config +spring.redis.host=@env.REDIS_HOST@ \ No newline at end of file diff --git a/src/main/environment/1097_docker.properties b/src/main/environment/1097_docker.properties new file mode 100644 index 0000000..5510dfc --- /dev/null +++ b/src/main/environment/1097_docker.properties @@ -0,0 +1,22 @@ +# DataSource settings: set here your own configurations for the database +spring.datasource.url=${DATABASE_1097_IDENTITY_URL} +spring.datasource.username=${DATABASE_IDENTITY_USERNAME} +spring.datasource.password=${DATABASE_IDENTITY_PASSWORD} +spring.datasource.driver-class-name=com.mysql.jdbc.Driver + +#ELK logging file name +logging.path=logs/ +logging.file.name=${IDENTITY_API_1097_LOGGING_FILE_NAME} + +springdoc.api-docs.enabled=${SWAGGER_DOC_ENABLED} +springdoc.swagger-ui.enabled=${SWAGGER_DOC_ENABLED} + +jwt.secret=${JWT_SECRET_KEY} + # TM Config +tm-url=${TM_API} + +# FHIR Config +fhir-url=${FHIR_API} + +# Redis Config +spring.redis.host=${REDIS_HOST} \ No newline at end of file diff --git a/src/main/environment/1097_example.properties b/src/main/environment/1097_example.properties index 6a7d8b0..9eeee5c 100644 --- a/src/main/environment/1097_example.properties +++ b/src/main/environment/1097_example.properties @@ -14,4 +14,7 @@ logging.file.name=logs/1097identity-api.log tm-url=http://localhost:8089/ # FHIR Config -fhir-url=http://localhost:8093/ \ No newline at end of file +fhir-url=http://localhost:8093/ + +# Redis Config +spring.redis.host=localhost \ No newline at end of file diff --git a/src/main/environment/common_ci.properties b/src/main/environment/common_ci.properties index d6b426e..debf33c 100644 --- a/src/main/environment/common_ci.properties +++ b/src/main/environment/common_ci.properties @@ -18,3 +18,6 @@ tm-url=@TM_API@ # FHIR Config fhir-url=@FHIR_API@ + +# Redis Config +spring.redis.host=@env.REDIS_HOST@ \ No newline at end of file diff --git a/src/main/environment/common_docker.properties b/src/main/environment/common_docker.properties new file mode 100644 index 0000000..4409906 --- /dev/null +++ b/src/main/environment/common_docker.properties @@ -0,0 +1,23 @@ +# DataSource settings: set here your own configurations for the database +spring.datasource.url=${DATABASE_IDENTITY_URL} +spring.datasource.username=${DATABASE_IDENTITY_USERNAME} +spring.datasource.password=${DATABASE_IDENTITY_PASSWORD} +spring.datasource.driver-class-name=com.mysql.jdbc.Driver + +#ELK logging file name +logging.path=logs/ +logging.file.name=${IDENTITY_API_LOGGING_FILE_NAME} + +springdoc.api-docs.enabled=${SWAGGER_DOC_ENABLED} +springdoc.swagger-ui.enabled=${SWAGGER_DOC_ENABLED} + +jwt.secret=${JWT_SECRET_KEY} + + # TM Config +tm-url=${TM_API} + +# FHIR Config +fhir-url=${FHIR_API} + +# Redis Config +spring.redis.host=${REDIS_HOST} \ No newline at end of file diff --git a/src/main/environment/common_example.properties b/src/main/environment/common_example.properties index 79dfeb1..ca58c85 100644 --- a/src/main/environment/common_example.properties +++ b/src/main/environment/common_example.properties @@ -13,4 +13,7 @@ logging.file.name=logs/identity-api.log tm-url=http://localhost:8089/ # FHIR Config -fhir-url=http://localhost:8093/ \ No newline at end of file +fhir-url=http://localhost:8093/ + +# Redis Config +spring.redis.host=localhost \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 0a0293e..a0828d0 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -12,7 +12,6 @@ spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQLDialect #Below lines are added for security reasons spring.session.store-type=redis -spring.redis.host=localhost spring.redis.password= spring.redis.port=6379