title: Java Gradle build taking too much time in docker
body: <p>The java build of the project is taking too much time to build in docker environment almost 30 mins with very few dependencies
   This is the dockerfile</p>
  
  <pre><code>FROM gradle:4.10.0-jdk8-alpine AS build
  COPY --chown=gradle:gradle . /home/gradle/src/producer
  WORKDIR /home/gradle/src/producer
  RUN gradle bootJar --no-daemon --stacktrace
  FROM openjdk:8-jdk-alpine
  ARG JAR_FILE=build/libs/*.jar
  COPY --from=build /home/gradle/src/producer/build/libs/*.jar producer.jar
  ENTRYPOINT ["java","-jar","/producer.jar"]'
  </code></pre>
  
  <p>This is the build.gradle file</p>
  
  <pre><code>plugins {
      id 'org.springframework.boot' version '2.2.6.RELEASE'
      id 'io.spring.dependency-management' version '1.0.9.RELEASE'
      id 'java'
  }
  
  
  group = 'com.example'
  version = '0.0.1-SNAPSHOT'
  sourceCompatibility = '1.8'
  
  configurations {
      compileOnly {
          extendsFrom annotationProcessor
      }
  }
  
  repositories {
      mavenCentral()
  }
  
  bootJar {
      baseName = 'gs-spring-boot-docker-server'
      version =  '0.1.0'
  }
  
  ext {
      set('springCloudVersion', "Hoxton.SR4")
  }
  
  dependencies {
      implementation 'org.springframework.boot:spring-boot-starter-data-rest'
      implementation 'org.springframework.boot:spring-boot-starter-web'
      implementation 'org.springframework.boot:spring-boot-starter-webflux'
      implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-server'
      compileOnly 'org.projectlombok:lombok'
      annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
      annotationProcessor 'org.projectlombok:lombok'
      testImplementation('org.springframework.boot:spring-boot-starter-test') {
          exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
      }
      testImplementation 'io.projectreactor:reactor-test'
  }
  
  dependencyManagement {
      imports {
          mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
      }
  }
  
  test {
      useJUnitPlatform()
  }
  </code></pre>
  
  <p>Please let me know what could be done here? Whenever I run the docker build command, it is trying to pull the dependencies from the network I think so.</p>
  
  <pre><code>RUN gradle bootJar --no-daemon --stacktrace
  </code></pre>
  
  <p><br>
  But when I try to build bootJar using the Java IntelliJ editor which is the same command which I entered in the dockerfile,  it is taking less than 10 seconds, and even during the first build, it took around 1-2 minutes. </p>