Added caching of maven dependencies
This commit is contained in:
@@ -1,9 +1,16 @@
|
|||||||
FROM maven:3.9-eclipse-temurin-21 AS build
|
FROM maven:3.9-eclipse-temurin-21 AS build
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Separate layer for dependencies: only re-runs when pom.xml changes.
|
||||||
|
# The cache mount keeps ~/.m2 across builds so even pom.xml changes
|
||||||
|
# don't require a full re-download.
|
||||||
COPY pom.xml .
|
COPY pom.xml .
|
||||||
RUN mvn dependency:go-offline -B
|
RUN --mount=type=cache,target=/root/.m2 \
|
||||||
|
mvn dependency:go-offline -B -q
|
||||||
|
|
||||||
COPY src ./src
|
COPY src ./src
|
||||||
RUN mvn package -DskipTests -B
|
RUN --mount=type=cache,target=/root/.m2 \
|
||||||
|
mvn package -DskipTests -B
|
||||||
|
|
||||||
FROM eclipse-temurin:21-jre
|
FROM eclipse-temurin:21-jre
|
||||||
WORKDIR /deployments
|
WORKDIR /deployments
|
||||||
|
|||||||
Reference in New Issue
Block a user