I have simple docker file as below which works fine if i build locally.
FROM openjdk:8-jdk-alpine
MAINTAINER My team "contact@mycompany.io"
RUN mkdir /app
WORKDIR /app
COPY myapp-0.0.1.jar /app
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "myapi-0.0.1.jar"]
ENV JAVA_OPTS -server
EXPOSE 8080
VOLUME ["/tmp"]
When I try to run same from bitbucket pipeline it shows following error
Building image using context '/opt/atlassian/pipelines/agent/build'.
Using tag 'io.mycompany.api/api:0.0.1' for image.
Step 1/7 : FROM openjdk:8-jdk-alpine
---> 224765a6bdbe
Step 2/7 : MAINTAINER My team "contact@mycompany.io"
---> Running in b2fd28aa71f5
---> 541c8f463238
Removing intermediate container b2fd28aa71f5
Step 3/7 : ADD myapi-0.0.1.jar app.jar
:buildDocker FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':buildDocker'.
> Could not build image: lstat myapi-0.0.1.jar: no such file or directory
Where as myapi-0.0.1.jar is there in root dir
Hey @Birajendu Sahu,
the key of the error message is
lstat myapi-0.0.1.jar: no such file or directory
in your Dockerfile you have the instruction
COPY myapp-0.0.1.jar /app
Which copies myapp-0.0.1.jar from the root of your docker context.
When you run docker build, ensure your jar file exists and is readable by the docker client.
thanks,
Seb
Hi @SebC,
Thanks for your response. I an not sure how to check files presence in bitbucket pipeline build. The same dockerfile works fine in local mac system.
regards,
Birajendu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I would add commands into the script section of your pipeline. If you add ls -al ahead of docker build, you see all the files in your working directory.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Will try, Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.