devops(backend): pin eclipse-temurin tags, skip test compilation, document jar glob
- Pin to eclipse-temurin:21.0.10_7-{jdk,jre}-noble for reproducible builds
- Switch -DskipTests to -Dmaven.test.skip=true: skips test compilation entirely,
not just execution — faster and avoids build failures from test-only missing classes
- Add comment on COPY *.jar explaining why the glob is safe (Spring Boot renames
the pre-repackage artifact to .jar.original, leaving only one .jar in target/)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
FROM eclipse-temurin:21-jdk AS builder
|
FROM eclipse-temurin:21.0.10_7-jdk-noble AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy wrapper and POM first — dependency layer is cached separately from source
|
# Copy wrapper and POM first — dependency layer is cached separately from source
|
||||||
@@ -7,10 +7,12 @@ COPY mvnw pom.xml ./
|
|||||||
RUN --mount=type=cache,target=/root/.m2 ./mvnw dependency:go-offline -q
|
RUN --mount=type=cache,target=/root/.m2 ./mvnw dependency:go-offline -q
|
||||||
|
|
||||||
COPY src ./src
|
COPY src ./src
|
||||||
RUN --mount=type=cache,target=/root/.m2 ./mvnw clean package -DskipTests -q
|
# -Dmaven.test.skip=true skips test compilation entirely (not just execution)
|
||||||
|
RUN --mount=type=cache,target=/root/.m2 ./mvnw clean package -Dmaven.test.skip=true -q
|
||||||
|
|
||||||
FROM eclipse-temurin:21-jre
|
FROM eclipse-temurin:21.0.10_7-jre-noble
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
# Spring Boot repackages to *.jar; pre-repackage artifact uses .jar.original, not .jar
|
||||||
COPY --from=builder /app/target/*.jar app.jar
|
COPY --from=builder /app/target/*.jar app.jar
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
CMD ["java", "-jar", "app.jar"]
|
CMD ["java", "-jar", "app.jar"]
|
||||||
|
|||||||
Reference in New Issue
Block a user