Docker build stuck in Gradle task

633 Views Asked by At

When I try to run this Docker image it stays stuck forever:

FROM gradle:7.4.2-jdk11 as build
ENV GRADLE_OPTS="-Dorg.gradle.daemon=false"
WORKDIR /usr/src/app
COPY . .
RUN ./gradlew shadowJar


FROM adoptopenjdk:latest
WORKDIR /usr/src/app
COPY --from=build /usr/src/app/build/libs ./

This is the docker-compose.yml file:

version: "3.8"
services:
  slack_bot:
    container_name: slack_bot
    platform: linux/amd64
    build: .
    ports:
      - "8000:8000"
    environment:
      PORT: 8000
    command: java -jar build/libs/slack-bot-1.0-SNAPSHOT-all.jar

This is the output of docker-compose up (stuck there with the seconds increasing forever):

 => [build 4/4] RUN ./gradlew shadowJar                                                                                                                                                            803.1s
 => => #  - Aggregated test and JaCoCo reports                                                                                                                                                           
 => => #  - Marking additional test source directories as tests in IntelliJ                                                                                                                              
 => => #  - Support for Adoptium JDKs in Java toolchains                                                                                                                                                 
 => => # For more details see https://docs.gradle.org/7.4.2/release-notes.html                                                                                                                           
 => => # To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/7.4.2/userguide/gradle_daemon.html#sec:disabling_the_daemon.                  
 => => # Daemon will be stopped at the end of the build                                                                                                                                                  

I tried multiple variations including turning on/off the Docker daemon, different Docker images, increasing JVM memory, etc. without success. I'm using the latest Docker (4.8.2) on an Apple M1. Any hints?

0

There are 0 best solutions below