Dcoker build not take .jar

Hi all, i’ve this docker file :

FROM maven:3-openjdk-17 AS build
# Set the working directory in the container
WORKDIR /app
# Copy the pom.xml and the project files to the container
COPY pom.xml .
COPY src ./src
# Build the application using Maven
RUN mvn clean install
# Use an official OpenJDK image as the base image
FROM  maven:3-openjdk-17
EXPOSE 8080
COPY target/*.jar app.jar
ENTRYPOINT ["java", "-jar", "/app.jar"]

When I run the docker build after I change something in my project, this configuration not take the new jar file and when I did docker run I didn’t see the change that I’ve done.

I’ve also try to create a new docker file in this way :

# Use an official Maven image as the base image
FROM maven:3-openjdk-17 AS build
# Set the working directory in the container
WORKDIR /app
# Copy the pom.xml and the project files to the container
COPY pom.xml .
COPY src ./src
# Build the application using Maven
RUN mvn clean package
# Use an official OpenJDK image as the base image
FROM openjdk:11-ea-17-jre-slim
# Set the working directory in the container
WORKDIR /app
# Copy the built JAR file from the previous stage to the container
COPY --from=build /app/target/peco-0.0.1-SNAPSHOT.jar .
# Set the command to run the application
CMD ["java", "-jar", "peco-0.0.1-SNAPSHOT.jar"]

but I received error.

Thanks all for support and help.

Oh, you received an error? Let me quickly turn on my magic light bowl to look into the past what has happened on your machine :rofl:

[/irony off]

What’s the error?