From dbb196af4d4ee43fe6f377f42ef01f7a2d7473c3 Mon Sep 17 00:00:00 2001 From: Peter Siegmund Date: Sun, 13 Oct 2024 00:45:34 +0200 Subject: [PATCH] optimize Dockerfile Signed-off-by: Peter Siegmund --- Dockerfile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index f4a0619..594d77a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,6 @@ # Stage that builds the application, a prerequisite for the running stage FROM eclipse-temurin:21-jdk-noble AS build -ARG SERVICE_ROOT - RUN apt-get update -qq # Stop running as root at this point @@ -12,11 +10,11 @@ RUN chown app:app /usr/src/app/ USER app # Copy pom.xml and prefetch dependencies so a repeated build can continue from the next step with existing dependencies -COPY --chown=app ${SERVICE_ROOT}/gradle/ ./gradle -COPY --chown=app ${SERVICE_ROOT}/gradlew ${SERVICE_ROOT}/build.gradle ${SERVICE_ROOT}/settings.gradle ${SERVICE_ROOT}/app.json ./ +COPY --chown=app ./gradle/ ./gradle +COPY --chown=app ./gradlew ./build.gradle ./settings.gradle ./gradle.properties ./app.json ./ # Copy all needed project files to a folder -COPY --chown=app:app ${SERVICE_ROOT}/src ./src +COPY --chown=app:app ./src ./src # Build the production package RUN ./gradlew clean build -x test