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

In Generated Dockerfile COPY Command syntax formed incorrectly #1097

Closed
anand2k24 opened this issue Oct 9, 2023 · 8 comments · Fixed by #1099
Closed

In Generated Dockerfile COPY Command syntax formed incorrectly #1097

anand2k24 opened this issue Oct 9, 2023 · 8 comments · Fixed by #1099

Comments

@anand2k24
Copy link

anand2k24 commented Oct 9, 2023

Describe the bug
As is generated : COPY --from= rating-buildstage/app/target/rating-0.0.1-SNAPSHOT.jar .
It has to be like : COPY --from=rating-buildstage /app/target/rating-0.0.1-SNAPSHOT.jar .

There should be space between image name build jar file path, but instead the space presented after =
COPY --from=<repository_image_name>

To Reproduce
Steps to reproduce the behavior:

  1. Using the Mov2Kube UI Version http://localhost:8080/
  2. After Planning, use Tranform to the generate the outcome
  3. go to the scripts folder in the output directory generated, run the command buildimages.bat podman
    STEP 1/3: FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
    STEP 2/3: COPY rating-0.0.1-SNAPSHOT.jar .
    --> 62de1907ec18
    STEP 3/3: COPY --from= rating-buildstage/app/target/rating-0.0.1-SNAPSHOT.jar .
    Error: COPY --from=: no stage or image found with that name

Expected behavior
The build should have completed without any errors

Screenshots
STEP 3/3: COPY --from= rating-buildstage/app/target/rating-0.0.1-SNAPSHOT.jar .
Error: COPY --from=: no stage or image found with that name

Desktop (please complete the following information):

  • OS: Windows
  • Version [e.g. 22]. `version: v0.3.11-rc.0 gitCommit: 82196544d43ab6ae9f93efe9d9f5408b411d6374 gitTreeState: clean

Additional context
Rest all works fine, I have even tried it seperately, special thanks to Padmanabha V Seshadri to helping in slack community to go forward

@anand2k24 anand2k24 changed the title Move2Kube: In Generated Dockerfile COPY Command syntax formed incorrectly In Generated Dockerfile COPY Command syntax formed incorrectly Oct 9, 2023
@HarikrishnanBalagopal
Copy link
Contributor

@move2git Thanks for raising the issue.

In the Move2Kube UI please go to the Support page and copy/paste the details here.
This will help us debug the issue.

@anand2k24
Copy link
Author

CLI version: v0.3.11-rc.0+unreleased gitCommit: 9bc4e8b gitTreeState: clean goVersion: go1.18 platform: linux/amd64
API version: v0.3.11-rc.0+unreleased gitCommit: 2e2bd550826fb1bc60a2224abcb154fb60b2c05d gitTreeState: clean goVersion: go1.18 platform: linux/amd64
UI version: latest gitCommit: 3f31fb9c0b0503e2887403e9423fedeb6abd105c gitTreeState: clean
Docker docker socket is not mounted

@anand2k24
Copy link
Author

@HarikrishnanBalagopal I have pasted the details now

@HarikrishnanBalagopal
Copy link
Contributor

HarikrishnanBalagopal commented Oct 11, 2023

Thanks, possibly the space in this line between --from and the container name

COPY {{ if .BuildContainerName }}--from= {{ .BuildContainerName }}{{ end }}{{ .DeploymentFilePath }} .

Should make it similar to

COPY --chown=tomcat:root {{ if .BuildContainerName }}--from={{ .BuildContainerName }} {{ end }}{{ .DeploymentFilePath }} "$CATALINA_BASE"/webapps-javaee/

I think the space got introduced accidentally in this PR https://github.com/konveyor/move2kube/pull/1001/files#diff-04b72caa3d4688f1c2eaa6edaca8db27cee3e2abd814dcff0d169c23b47a5d09R7

@anand2k24
Copy link
Author

@HarikrishnanBalagopal Thank you so much Hari for quickly looking at it and pointing to it. I also want to start contributing to open source. I don't know how to start and setup a test/debug environment in my local. Is there any help available to look in to it

@anand2k24
Copy link
Author

anand2k24 commented Oct 11, 2023

Thanks, possibly the space in this line between --from and the container name

COPY {{ if .BuildContainerName }}--from= {{ .BuildContainerName }}{{ end }}{{ .DeploymentFilePath }} .

Should make it similar to

COPY --chown=tomcat:root {{ if .BuildContainerName }}--from={{ .BuildContainerName }} {{ end }}{{ .DeploymentFilePath }} "$CATALINA_BASE"/webapps-javaee/

I think the space got introduced accidentally in this PR https://github.com/konveyor/move2kube/pull/1001/files#diff-04b72caa3d4688f1c2eaa6edaca8db27cee3e2abd814dcff0d169c23b47a5d09R7

Space should be between Container Name and DeploymentFilePath, you rightly pointed out the fix
Bug: --from= {{ .BuildContainerName }}{{ end }}{{ .DeploymentFilePath }}
Fix: --from={{ .BuildContainerName }} {{ end }}{{ .DeploymentFilePath }}

@anand2k24
Copy link
Author

@HarikrishnanBalagopal once done with fix and moved to pre-prod/prod, keep me informed, I will test it and confirm

@HarikrishnanBalagopal
Copy link
Contributor

HarikrishnanBalagopal commented Oct 11, 2023

@HarikrishnanBalagopal Thank you so much Hari for quickly looking at it and pointing to it. I also want to start contributing to open source. I don't know how to start and setup a test/debug environment in my local. Is there any help available to look in to it

Nice! You can take a look at issues labelled hacktoberfest in this repo for some idea on how to get started #881
Also this https://github.com/konveyor/move2kube/blob/main/contributing.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
2 participants