diff --git a/salary/Dockerfile b/salary/Dockerfile index 9d77e69..f8ac776 100644 --- a/salary/Dockerfile +++ b/salary/Dockerfile @@ -1,18 +1,25 @@ -FROM maven:latest as builder -MAINTAINER Opstree Solutions -WORKDIR /java/ -COPY pom.xml /java/ -COPY src /java/src/ +# Stage 1: Build the application using Maven and Java 17 +FROM maven:3.8.8-eclipse-temurin-17 AS builder +LABEL maintainer="Opstree Solutions" + +WORKDIR /java +COPY pom.xml . +COPY src ./src + RUN mvn clean package -FROM alpine:latest -MAINTAINER Opstree Solutions -USER root -RUN apk update && \ - apk add openjdk17 +# Stage 2: Run the application with a minimal runtime image +FROM eclipse-temurin:17-jdk-alpine +LABEL maintainer="Opstree Solutions" + +WORKDIR /app COPY --from=builder /java/target/salary-0.3.0-RELEASE.jar /app/salary.jar -COPY ./config.yaml /root/config/config.yaml -ENV CONFIG_FILE "/root/config/config.yaml" +COPY ./config.yaml /app/config/config.yaml +ENV CONFIG_FILE=/app/config/config.yaml + +# Expose the app port EXPOSE 8080 -ENTRYPOINT ["/usr/bin/java", "-jar", "/app/salary.jar"] + +# Run the Spring Boot app +ENTRYPOINT ["java", "-jar", "/app/salary.jar"] \ No newline at end of file diff --git a/salary/pom.xml b/salary/pom.xml index fe3465b..4c3b636 100644 --- a/salary/pom.xml +++ b/salary/pom.xml @@ -1,34 +1,27 @@ - + 4.0.0 + org.springframework.boot spring-boot-starter-parent 2.7.4 - + + com.opstree.microservice salary 0.3.0-RELEASE salary Salary Microservice - - - - org.jacoco - jacoco-maven-plugin - - - - - report - - - - - - + + + 17 + + org.springframework.boot @@ -78,15 +71,42 @@ + org.springframework.boot spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 17 + 17 + + + + org.jacoco jacoco-maven-plugin - 0.8.6 + 0.8.8 + + + + prepare-agent + + + + report + test + + report + + +