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
<span>Building image using context '/opt/atlassian/pipelines/agent/build'.</span><span>Using tag 'io.mycompany.api/api:0.0.1' for image.</span><span>Step 1/7 : FROM openjdk:8-jdk-alpine</span><span>---> 224765a6bdbe</span><span>Step 2/7 : MAINTAINER My team <a href="mailto:%22contact@biomex.io" target="_blank" rel="nofollow noopener noreferrer">"contact@mycompany.io</a>"</span><span>---> Running in b2fd28aa71f5</span><span>---> 541c8f463238</span><span>Removing intermediate container b2fd28aa71f5</span><span>Step 3/7 : ADD myapi-0.0.1.jar app.jar</span><span>:buildDocker FAILED</span><span>FAILURE: Build failed with an exception.</span><span>* What went wrong:</span><span>Execution failed for task ':buildDocker'.</span><span>> Could not build image: lstat myapi-0.0.1.jar: no such file or directory</span>
Where as myapi-0.0.1.jar is there in root dir