Posts

Showing posts with the label gradle

Gradle build is so slow in docker

Before FROM gradle:6.2.1-jdk11 RUN gradle --version && java -version WORKDIR /app COPY ./ /app/ RUN gradle clean build --no-daemon CMD java -jar build/libs/*.jar   AFTER FROM gradle:6.2.1-jdk11 RUN gradle --version && java -version WORKDIR /app # Only copy dependency-related files COPY build.gradle gradle.properties settings.gradle /app/ # Only download dependencies # Eat the expected build failure since no source code has been copied yet RUN gradle clean build --no-daemon > /dev/null 2>&1 || true # Copy all files COPY ./ /app/ # Do the actual build RUN gradle clean build --no-daemon CMD java -jar build/libs/*.jar