Dockerfile

This commit is contained in:
Florian 2025-11-13 09:15:21 +01:00
parent e4f9c9f69f
commit f87e9b4832

35
Dockerfile Normal file
View File

@ -0,0 +1,35 @@
FROM eclipse-temurin:17 AS maven
WORKDIR application
COPY . .
RUN ./mvnw clean install
ARG ARTIFACT_NAME
RUN cp target/${ARTIFACT_NAME}-*.jar application.jar
FROM eclipse-temurin:17 AS builder
WORKDIR application
COPY --from=maven application/application.jar .
RUN java -Djarmode=layertools -jar application.jar extract
FROM eclipse-temurin:17
WORKDIR application
ARG EXPOSED_PORT
EXPOSE ${EXPOSED_PORT}
ENV SPRING_PROFILES_ACTIVE=docker
COPY --from=builder application/dependencies/ ./
# fix for https://stackoverflow.com/questions/51115856/docker-failed-to-export-image-failed-to-create-image-failed-to-get-layer
# (only last copy caused issue)
# this seems to be triggered by using btrfs:
# https://github.com/moby/moby/issues/36573
RUN true
COPY --from=builder application/spring-boot-loader/ ./
RUN true
COPY --from=builder application/snapshot-dependencies/ ./
RUN true
COPY --from=builder application/application/ ./
ENTRYPOINT ["java", "org.springframework.boot.loader.launch.JarLauncher"]