Dockerfile 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # Use an official Maven image as the base image
  2. FROM maven:3.8.5-openjdk-17 AS build
  3. # Set the working directory in the container
  4. WORKDIR /app
  5. # Copy the pom.xml and the project files to the container
  6. ADD ./pom.xml pom.xml
  7. ADD settings.xml /usr/share/maven/conf/settings.xml
  8. RUN mvn dependency:go-offline
  9. COPY src /app/src
  10. # Build the application using Maven
  11. RUN mvn clean package -DskipTests
  12. # Use an official OpenJDK image as the base image
  13. FROM openjdk:17-jdk-slim
  14. # Set the working directory in the container
  15. WORKDIR /app
  16. # Install fonts and fontconfig for Excel export (AWT/POI)
  17. RUN apt-get update && \
  18. apt-get install -y \
  19. fontconfig \
  20. ttf-dejavu \
  21. libfreetype6 \
  22. libfontconfig1 \
  23. libx11-6 \
  24. libxext6 \
  25. libxi6 \
  26. libxtst6 \
  27. libxrender1 \
  28. && apt-get clean \
  29. && rm -rf /var/lib/apt/lists/*
  30. # Copy the built JAR file from the previous stage to the container
  31. COPY --from=build /app/target/*.jar ./app.jar
  32. # Set the command to run the application
  33. CMD ["java", "-jar", "/app/app.jar","--spring.config.location=file:/app/application.yaml"]
  34. EXPOSE 8080