Reputation: 619
I am trying to build docker image having following command in Dockerfile
FROM openjdk:13-jdk-alpine AS builder
WORKDIR /app-build
ADD . .
RUN pwd
RUN ./gradlew console:build
RUN ls /app-build/console/build/libs/
It exit with following message
/bin/sh: ./gradlew: not found
The command '/bin/sh -c ./gradlew console:build' returned a non-zero code: 127
Upvotes: 0
Views: 6568
Reputation: 78
you need to place your local directory path where your docker file is located and the path of your code repo in docker build command
docker build -f /home/ubuntu/your_project_repo/Dockerfile /home/ubuntu/your_project_repo/
Upvotes: 1
Reputation: 46
I am not certain what openjdk:13-jdk-alpine
already has in its image, but if does not already contain a ./gradlew
executable file, you will need to double-check that the line ADD . .
in your Dockerfile
is actually copying in the file ./gradlew
.
Is ./gradlew
stored locally in the same path as your Dockerfile? ADD . .
will take all the files in the path of your Dockerfile and copy it over into your custom image.
Another way to check to see if you are copying in the correct files is by building the image and then using a docker exec
command to manually check to see what files are in your custom Docker image.
I would use the following command to do this: docker exec -it <name_of_docker_image> bash
Upvotes: 1