Então, testando as diferenças (no mesmo projeto), quando alterei o dockerfile para o do curso, tive problemas com esse trecho:
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} application.jar
RUN java -Djarmode=layertools -jar application.jar extract
recebo um erro:
=> ERROR [builder 8/9] COPY target/*.jar application.jar 0.1s
------
> [builder 8/9] COPY target/*.jar application.jar:
------
Dockerfile:9
--------------------
7 | RUN ./mvnw package -DskipTests
8 | ARG JAR_FILE=target/*.jar
9 | >>> COPY ${JAR_FILE} application.jar
10 | RUN java -Djarmode=layertools -jar application.jar extract
11 |
--------------------
ERROR: failed to solve: lstat /var/lib/docker/tmp/buildkit-mount844656953/target: no such file or directory
o dockerfile (só altero a versão da imagem):
FROM eclipse-temurin:21-jdk-alpine as builder
WORKDIR application
COPY mvnw .
COPY .mvn .mvn
COPY pom.xml .
COPY src src
RUN ./mvnw package -DskipTests
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} application.jar
RUN java -Djarmode=layertools -jar application.jar extract
FROM eclipse-temurin:21-jre-alpine
WORKDIR application
COPY --from=builder application/dependencies/ ./
COPY --from=builder application/spring-boot-loader/ ./
COPY --from=builder application/snapshot-dependencies/ ./
COPY --from=builder application/application/ ./
ENTRYPOINT ["java", "org.springframework.boot.loader.launch.JarLauncher"]