I can’t find my jar file when trying to copy it in a multi stage docker build

So I am very new to docker and I have been trying to dockerise my spring-boot application. I managed to get it working with a given JAR file but now I would like to make a multi stage build to build the JAR file using gradle so that I don’t have to manually generate the JAR before running docker build {app-name}

This is my current setup. It fails to find the jar file and I don’t know how I can navigate the filesystem to find it (other than running shell commands in the dockerfile to print out the files & folders)


FROM gradle:jdk8 as build

COPY --chown:gradle:gradle . /home/gradle/src

WROKDIR /home/gradle/src 

RUN gradle clean build --parallel

FROM  openjdk:8-alpine

WORKDIR /usr/app

COPY --from=build /home/gradle/src/app-name.jar /usr/app/

RUN sh -c 'touch app-name.jar'

ENTRYPOINT ["java", "-jar", "app-name.jar"]

Console Output

Step 7/9. : COPY —from=build /home/gradle/src/app-name.jar /usr/app/
COPY failed: stat /var/lib/ldocker/overlay2/22e326d9f26f581a629417c35e226428f3cc63fd496799c55dde4be413ca26690/merged/home/gradle/src/app-name.jar: no such file or directory

Source: StackOverflow