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

Build docker commands better #441

Merged
merged 1 commit into from
Feb 23, 2024

Conversation

cherylking
Copy link
Member

For ci.maven issue OpenLiberty/ci.maven#1797

Handle building the docker commands for devc better. By adding each command option/argument separately, the ProcessBuilder can handle paths with spaces. Before we were building one big String, and then turning it into a String[] using a tokenizer that used spaces (among other things like carriage returns, line feeds, etc) to separate the String into command arguments. This caused some arguments to get split into multiple, which was obviously not correct.

@cherylking
Copy link
Member Author

cherylking commented Feb 22, 2024

With this PR, I used the docker getting started guide and ran mvn liberty:devc successfully. The docker build command looked like this (took the String[] and joined it with a single space as delimiter to log the command). You don't see the quoting/escaping that gets done by ProcessBuilder, but the fact the command runs successfully proves it is handling the path with spaces correctly.

[INFO] Building container image...
[INFO] Container command: docker build --pull -f /Users/xyz/gitForks/guide-docker/finish with space/target/.libertyDevc/tempContainerfile5250737592129611435 -t guide-docker-dev-mode /Users/xyz/gitForks/guide-docker/finish with space

Here is an image proving devc was successful:

Screenshot 2024-02-22 at 4 26 26 PM

Before this PR, the same devc command resulted in the following error:

[ERROR] Failed to execute goal io.openliberty.tools:liberty-maven-plugin:3.10:devc (default-cli) on project guide-docker: Error starting the server in dev mode.: Could not build container image using Containerfile: /Users/xyz/gitForks/guide-docker/finish with space/Dockerfile. Address the following container build error and then start dev mode again: DEPRECATED: The legacy builder is deprecated and will be removed in a future release. RC=1 -> [Help 1]

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

Successfully merging this pull request may close these issues.

2 participants