Vnuuk
Vnuuk

Reputation: 6527

Gradlew init - no such file or directory

I'm trying to build my Java app using Docker file. There is a step that does next:

RUN ./gradlew init

There is such file gradlew.bat for my Windows machine. And if I execute it from PowerShell all goes well.

FROM openjdk:8-jdk-alpine as builder

WORKDIR home

#get gradle wrapper
ADD gradle /home/gradle
COPY gradlew ./
COPY gradlew.bat ./
RUN ./gradlew init <--- gives error

Running command from Docker file give me next error. What I do wrong?

enter image description here

Upvotes: 2

Views: 2764

Answers (2)

Rishabh Sharma
Rishabh Sharma

Reputation: 9

The first thing you should check is the line breaking of your gradlew file. Changing it to LF will solve your issue.

Upvotes: 0

Timir
Timir

Reputation: 1425

Well it's not a problem in your dockerfile. I created dummy scripts to mimic your build steps, they go through fine:

$ docker build .
.
.
Step 6 : RUN ./gradlew init
 ---> Running in 0228bf5340d9
This is dummy output: init
 ---> 7835d2972bf9
Removing intermediate container 0228bf5340d9
Successfully built 7835d2972bf9

Apparently a problem with gradlew instead, also reported here

Hope this helps.

Upvotes: 2

Related Questions