I have the following Dockerfile:
FROM gradle:6.3-jdk8 as builder
WORKDIR /
COPY . /
RUN gradle shadow --no-daemon
EXPOSE 9999
CMD ["java", "-jar", "search-all.jar"]
I want to avoid Gradle daemon starting every time I build the image. Is there any possibility or a workaround to achieve this? I mentioned the --no-daemon but it is still started.
This question has already an extensive answer on the Gralde forums: Using –no-daemon, but still see a process called “Gradle Worker Daemon 1”.
In short: The Gradle daemon process is the one executing the build and started always no matter on what has been specified on the command line. If
--no-daemonis specified, the process is terminated after build completion.Original answer from the Gradle forums: