Skip to content

Commit ee74657

Browse files
committed
Fix Dockerfile for spring boot 4.10
1 parent a7efbf2 commit ee74657

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,24 @@ ARG VERSION
4444
WORKDIR /build
4545

4646
# unpack the uber jar into it's components and set release properties
47-
RUN java -Djarmode=layertools -jar target/app.jar extract --destination target/extracted && \
48-
echo "release.version=${VERSION}" > ./target/extracted/application/BOOT-INF/classes/release.properties
47+
RUN mkdir -p BOOT-INF/classes && echo "release.version=${VERSION}" > ./BOOT-INF/classes/release.properties && \
48+
jar uf target/app.jar BOOT-INF/classes/release.properties && \
49+
java -Djarmode=tools -jar target/app.jar extract --layers --destination target/extracted
4950

5051
#Choose prod or dev layer
5152
FROM extract-${RELEASE} AS pre-final
5253

5354
# Create the runtime image using a minimal base image
5455
# and copy only necessary files from the builder image
5556
FROM azul-zulu:21-jre-headless AS final
57+
WORKDIR /application
5658

5759
# Copy the executable from the "pre-final" stage.
60+
COPY --from=pre-final build/target/extracted/application/ ./
5861
COPY --from=pre-final build/target/extracted/dependencies/ ./
5962
COPY --from=pre-final build/target/extracted/spring-boot-loader/ ./
6063
COPY --from=pre-final build/target/extracted/snapshot-dependencies/ ./
61-
COPY --from=pre-final build/target/extracted/application/ ./
6264

6365
EXPOSE 8081
6466

65-
ENTRYPOINT [ "java", "org.springframework.boot.loader.launch.JarLauncher" ]
67+
ENTRYPOINT [ "java", "-jar", "app.jar" ]

0 commit comments

Comments
 (0)