From 77737009e7450745494f4d6d4e9a747cfa1145e8 Mon Sep 17 00:00:00 2001 From: Liri S Date: Sun, 7 Jul 2024 11:56:54 +0300 Subject: [PATCH] Speed up docker re-builds using mvn dependency:go-offline (#19078) * go offline * dup --- Dockerfile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 163f62d45d4c..543bc169f06d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,16 @@ COPY ./LICENSE ${GEN_DIR} # Required to compile openapi-generator COPY ./google_checkstyle.xml ${GEN_DIR} +# All poms are copied, then we go offline, to allow for better caching of code changes without fetching all dependencies each time +COPY ./modules/openapi-generator-gradle-plugin/pom.xml ${GEN_DIR}/modules/openapi-generator-gradle-plugin/ +COPY ./modules/openapi-generator-maven-plugin/pom.xml ${GEN_DIR}/modules/openapi-generator-maven-plugin/ +COPY ./modules/openapi-generator-online/pom.xml ${GEN_DIR}/modules/openapi-generator-online/ +COPY ./modules/openapi-generator-cli/pom.xml ${GEN_DIR}/modules/openapi-generator-cli/ +COPY ./modules/openapi-generator-core/pom.xml ${GEN_DIR}/modules/openapi-generator-core/ +COPY ./modules/openapi-generator/pom.xml ${GEN_DIR}/modules/openapi-generator/ +COPY ./pom.xml ${GEN_DIR} +RUN mvn dependency:go-offline + # Modules are copied individually here to allow for caching of docker layers between major.minor versions COPY ./modules/openapi-generator-gradle-plugin ${GEN_DIR}/modules/openapi-generator-gradle-plugin COPY ./modules/openapi-generator-maven-plugin ${GEN_DIR}/modules/openapi-generator-maven-plugin @@ -17,7 +27,6 @@ COPY ./modules/openapi-generator-online ${GEN_DIR}/modules/openapi-generator-onl COPY ./modules/openapi-generator-cli ${GEN_DIR}/modules/openapi-generator-cli COPY ./modules/openapi-generator-core ${GEN_DIR}/modules/openapi-generator-core COPY ./modules/openapi-generator ${GEN_DIR}/modules/openapi-generator -COPY ./pom.xml ${GEN_DIR} # Pre-compile openapi-generator-cli RUN mvn -B -am -pl "modules/openapi-generator-cli" package