Reputation: 2999
I'm trying to do continuous integration using VSTS for Java rest api.
I've added following lines for building Docker image:
FROM openjdk:8 ADD $(build.artifactstagingdirectory)/docker-spring.jar docker-spring.jar EXPOSE 8085 ENTRYPOINT ["java","-jar","docker-spring.jar"]
I'm getting following error: ADD failed: stat /var/lib/docker/tmp/docker-builder946930284/SpringRest/target/docker-spring.jar: no such file or directory
/usr/local/bin/docker failed with return code: 1
I could see lot few references, still not able to correlate the issue exactly.
Upvotes: 1
Views: 487
Reputation: 2543
This happens when you haven't supplied the path right. Make sure that your variable that has the path has the . for current directory, or / and the full path to the resources:
$(build.artifactstagingdirectory) = ./correct/relative/path/docker-spring.jar
or
$(build.artifactstagingdirectory) = /correct/full/path/path/docker-spring.jar<
Looking at your output I'd assume you're using "path/to/docker-spring.jar" which doesn't work.
EDIT: In your particular case you want to change the following line in the docker file:
What you have:
COPY /SpringRest/target/docker-spring.jar /usr/local/app/docker-spring.jar
What it should be:
COPY ./target/docker-spring.jar /usr/local/app/docker-spring.jar
Notice the little dot. This way it should work.
Upvotes: 1