In bitbucket-pipelines.yml
After mvn build the Jar file is saved to /opt/atlassian/pipelines/agent/build/target/ directory as per pipeline logs.
How do I use this location in the Dockerfile when building the image? Or set the location in pipelines?
Currently I get error:
ADD failed: stat /var/lib/docker/165536.165536/tmp/docker-builder912665471/target/app-0.0.1-SNAPSHOT.jar: no such file or directory.
Dockerfile:
FROM openjdk:8-jdk-alpine
ADD ./target/app-0.0.1-SNAPSHOT.jar app.jar
EXPOSE 8081
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
Adding the following resolved this:
artifacts:
- target/**
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have the same question. WHere exactly the artifacts: -target is specified?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Short answer: in bitbucket-pipelines.yml
Explanation:
Had the same issue. Had two steps in my pipeline a 'build and test' step and a 'deply to docker' step where i tried to copy the artifacts to the docker image. To pass the artifacts to from the 'build and test' step to the 'deply to docker' step I had to add this to the first step
artifacts:
- target/**
For more information see:
https://support.atlassian.com/bitbucket-cloud/docs/use-artifacts-in-steps/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.