# Use an official Maven image as the base image FROM maven:3.8.5-openjdk-17 AS build # Set the working directory in the container WORKDIR /app # Copy the pom.xml and the project files to the container ADD ./pom.xml pom.xml ADD settings.xml /usr/share/maven/conf/settings.xml RUN mvn dependency:go-offline COPY src /app/src # Build the application using Maven RUN mvn clean package -DskipTests # Use an official OpenJDK image as the base image FROM openjdk:17-jdk-slim # Set the working directory in the container WORKDIR /app # Install fonts and fontconfig for Excel export (AWT/POI) RUN apt-get update && \ apt-get install -y \ fontconfig \ fonts-dejavu \ fonts-liberation \ libfreetype6 \ libfontconfig1 \ libx11-6 \ libxext6 \ libxi6 \ libxtst6 \ libxrender1 \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* # Copy the built JAR file from the previous stage to the container COPY --from=build /app/target/*.jar ./app.jar # Set the command to run the application CMD ["java", "-jar", "/app/app.jar","--spring.config.location=file:/app/application.yaml"] EXPOSE 8080