Dockerfile 738 B

12345678910111213141516171819202122
  1. # Use an official Maven image as the base image
  2. FROM maven:3.8.5-openjdk-17-slim 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. COPY pom.xml .
  7. COPY src ./src
  8. COPY settings.xml /usr/share/maven/ref/
  9. # Build the application using Maven
  10. RUN mvn clean package -DskipTests
  11. # Use an official OpenJDK image as the base image
  12. FROM openjdk:17-jdk-slim
  13. # Set the working directory in the container
  14. WORKDIR /app
  15. # Copy the built JAR file from the previous stage to the container
  16. COPY --from=build /app/target/*.jar ./app.jar
  17. # Set the command to run the application
  18. CMD ["java", "-jar", "/app/app.jar","--spring.config.location=file:/app/application.yaml"]
  19. EXPOSE 8080