I'm trying to dockerize a spring boot app but i'm having trouble building a jar file with maven. I Already tried to follow this tutorial but somehow my .jar isn't being updated by the 'mvn package' command inside the Dockerfile.
If I manually run 'mvn package' and then build the image, it works.
this is my dockerfile
FROM openjdk:11
FROM maven:3.8-jdk-11 as maven_build
COPY pom.xml pom.xml
COPY src src
RUN mvn clean package
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java","-jar","/app.jar"]
my project structure
Demo
└── src
| ├── main
| │ ├── java
| │ └── com
| │ └── App.java
| │
| │
| └── test
|
├──── Dockerfile
├──── pom.xml