|
1 | | -# Multi-stage JVM image (fat executable artifact normalized to app.jar) |
2 | | -FROM eclipse-temurin:21-jdk AS build |
3 | | -WORKDIR /workspace |
4 | | -SHELL ["/bin/bash", "-c"] |
5 | | -COPY . . |
6 | | -# bootJar is disabled in build.gradle, so use `build` to produce WAR (or executable JAR if enabled later) |
7 | | -RUN ./gradlew clean build -x test --no-daemon |
8 | | -RUN set -e; shopt -s nullglob; files=(build/libs/*.[jw]ar); if [ ${#files[@]} -eq 0 ]; then echo "No jar/war produced"; ls -l build/libs; exit 1; fi; preferred=""; for f in "${files[@]}"; do case "$f" in *-plain.*) ;; *) preferred="$f"; break ;; esac; done; if [ -z "$preferred" ]; then preferred="${files[0]}"; fi; echo "Using artifact: $preferred"; cp "$preferred" build/libs/app.jar |
9 | | - |
10 | | -FROM eclipse-temurin:21-jre AS run |
11 | | -WORKDIR /app |
12 | | -COPY --from=build /workspace/build/libs/app.jar /app/app.jar |
13 | | - |
14 | | -EXPOSE 8080 5005 |
15 | | -ENV JAVA_OPTS="-Xms256m -Xmx512m" |
16 | | -# HEALTHCHECK --interval=10s --timeout=5s --retries=5 --start-period=15s \ |
17 | | -# CMD curl -f http://localhost:8080/actuator/health || exit 1 |
18 | | -ENTRYPOINT ["sh", "-c", "java ${JAVA_OPTS} -jar app.jar"] |
| 1 | +# Multi-stage JVM image (fat executable artifact normalized to app.jar) |
| 2 | +FROM eclipse-temurin:21-jdk AS build |
| 3 | +WORKDIR /workspace |
| 4 | +SHELL ["/bin/bash", "-c"] |
| 5 | +COPY . . |
| 6 | +# bootJar is disabled in build.gradle, so use `build` to produce WAR (or executable JAR if enabled later) |
| 7 | +RUN ./gradlew clean build -x test --no-daemon |
| 8 | +RUN set -e; shopt -s nullglob; files=(build/libs/*.[jw]ar); if [ ${#files[@]} -eq 0 ]; then echo "No jar/war produced"; ls -l build/libs; exit 1; fi; preferred=""; for f in "${files[@]}"; do case "$f" in *-plain.*) ;; *) preferred="$f"; break ;; esac; done; if [ -z "$preferred" ]; then preferred="${files[0]}"; fi; echo "Using artifact: $preferred"; cp "$preferred" build/libs/app.jar |
| 9 | +
|
| 10 | +FROM eclipse-temurin:21-jre AS run |
| 11 | +WORKDIR /app |
| 12 | +COPY --from=build /workspace/build/libs/app.jar /app/app.jar |
| 13 | +
|
| 14 | +EXPOSE 8080 5005 |
| 15 | +ENV JAVA_OPTS="-XX:InitialRAMPercentage=75.0 -XX:MaxRAMPercentage=75.0 -XX:+UseContainerSupport -XX:+UseSerialGC" |
| 16 | +# HEALTHCHECK --interval=10s --timeout=5s --retries=5 --start-period=15s \ |
| 17 | +# CMD curl -f http://localhost:8080/actuator/health || exit 1 |
| 18 | +ENTRYPOINT ["sh", "-c", "java ${JAVA_OPTS} -jar app.jar"] |
0 commit comments