Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue building docker image #48

Open
ajaufura opened this issue Jun 8, 2022 · 6 comments
Open

Issue building docker image #48

ajaufura opened this issue Jun 8, 2022 · 6 comments

Comments

@ajaufura
Copy link

ajaufura commented Jun 8, 2022

Hello,

I have folk your repo and i'm having this issue on building the docker image:

Step 3/5 : COPY ./build/libs/my-app-1.0-SNAPSHOT.jar /usr/app/
COPY failed: file not found in build context or excluded by .dockerignore: stat build/libs/my-app-1.0-SNAPSHOT.jar: file does not exist
Error: Command failed: docker build -f Dockerfile -t docker.io/***/myrepo/demo-app:master-27211ac .

Do you have an idea of the missing .jar file ? Thanks.

@kanishksha
Copy link

i also havin same problem...

@mhmdahmed167
Copy link

Hello,

I have folk your repo and i'm having this issue on building the docker image:

Step 3/5 : COPY ./build/libs/my-app-1.0-SNAPSHOT.jar /usr/app/ COPY failed: file not found in build context or excluded by .dockerignore: stat build/libs/my-app-1.0-SNAPSHOT.jar: file does not exist Error: Command failed: docker build -f Dockerfile -t docker.io/***/myrepo/demo-app:master-27211ac .

Do you have an idea of the missing .jar file ? Thanks.

Got the solution:
If you open the Dockerfile and checkout the components in COPY and ENTRYPOINT, the project name will be "my-app-1.0-SNAPSHOT.jar" just change it to "java-app-1.0-SNAPSHOT.jar"
It should run smoothly after that

@akashgoyal89
Copy link

@mhmdahmed167 your solution works...how did you reached this solution?...where did you check?

@mhmdahmed167
Copy link

mhmdahmed167 commented Oct 2, 2022 via email

@maulanaakbardj
Copy link

maulanaakbardj commented Nov 14, 2022

solution: open dockerfile and replace
COPY ./build/libs/my-app-1.0-SNAPSHOT.jar /usr/app/
with
COPY ./build/libs/java-app-1.0-SNAPSHOT.jar /usr/app/
and
ENTRYPOINT ["java", "-jar", "my-app-1.0-SNAPSHOT.jar"]
with
ENTRYPOINT["java", "-jar", "java-app-1.0-SNAPSHOT.jar"]

make sure you have a build folder like in the new-ci-workflow branch this folder contains jar files

@matthewfischl
Copy link

matthewfischl commented Oct 4, 2023

@maulanaakbardj and @mhmdahmed167 : The solution works, but a following step fails with the below message;

Error: Unsupported GitHub event - only supports push https://help.github.com/en/articles/events-that-trigger-workflows#push-event-push

Does this mean that we can't build the docker image as part of the pull request? I.e., we can only build the docker image when pushing to main?

UPDATE: In the dockerfile, changing:

uses: mr-smithers-excellent/docker-build-push@v4

to

uses: mr-smithers-excellent/docker-build-push@v6

This resolves the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants