diff --git a/.gitignore b/.gitignore index c3c82d6..9005aa8 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,9 @@ target/ *.iml *.ipr +### environment ### +.env + ### NetBeans ### nbproject/private/ build/ 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 ea751c0..d19b7dc 100644 --- a/pom.xml +++ b/pom.xml @@ -462,7 +462,18 @@ - + + org.springframework.boot + spring-boot-maven-plugin + 3.2.2 + + + + repackage + + + + diff --git a/src/main/environment/admin_ci.properties b/src/main/environment/admin_ci.properties index 46262ac..e172064 100644 --- a/src/main/environment/admin_ci.properties +++ b/src/main/environment/admin_ci.properties @@ -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 @@ -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@ \ No newline at end of file diff --git a/src/main/environment/admin_docker.properties b/src/main/environment/admin_docker.properties new file mode 100644 index 0000000..d530138 --- /dev/null +++ b/src/main/environment/admin_docker.properties @@ -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}