I have a Dockerfile in the root directory of a Spring Boot application and also I have a target folder in the same path as shown in below structure:
|--src
|--main
|--com.abc.myApp
|--target/xyz.jar
|--Dockerfile
|--pom.xml
My Dockerfile looks as below:
From openjdk:8-jdk-alpine
WORKDIR /opt
ADD /target/xyz.jar .
When I try to execute using following command:
docker build . -t xyz
I am getting error as below:
Step 3/3 : ADD /target/xyz.jar .
ADD failed: stat /var/lib/docker/tmp/docker-builder225663872/target/xyz.jar: no such file or directory
The Dockerfile is present at /opt/MyApp/Dockerfile and target folder is present at /opt/MyApp/target/xyz.jar
Where am I going wrong? Also I do not have any .dockerignore file.