I have built a simple hello world rest service using spring boot. On my local machine (Ubuntu 14.04) when I run mvn package
command, a runnable jar is getting created under target folder: equation-1.0-SNAPSHOT.jar
. When I run this jar using java -jar equation-1.0-SNAPSHOT.jar
I can see the hello world message via browser.
Then I build a docker image using docker build -t hello:0.1 .
. My Dockerfile looks like below.
FROM java:8
COPY ./target/equation-1.0-SNAPSHOT.jar ./app.jar
EXPOSE 8080
CMD java -jar app.jar
Image gets built successfully and when I run this image using docker run -it -p 5000:8080 hello:0.1
I can see hello world message on http://localhost:5000/hello
.
So far so good....
Code exists on github and I linked this github repo to Docker Hub. When I trigger an automated build on Docker Hub it is failing with a target/equation-1.0-SNAPSHOT.jar: no such file or directory
message. Below is all Logs I see.
Starting to clone
Cloning into '.'...
Cloning done
Starting Build
KernelVersion: 3.13.0-40-generic
Os: linux
BuildTime: 2016-02-22T21:37:01.910365059+00:00
ApiVersion: 1.22
Version: 1.10.2
GitCommit: c3959b1
Arch: amd64
GoVersion: go1.5.3
Starting build of index.docker.io/mehmetatas/equation-solver:latest...
Step 1 : FROM java:8
---> 80a9d37df88e
Step 2 : COPY ./target/equation-1.0-SNAPSHOT.jar ./app.jar
lstat target/equation-1.0-SNAPSHOT.jar: no such file or directory