-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
docker build using -f instead of implied default #471
Conversation
{ | ||
return await ExecuteDockerCommandAsync(context, "build", $"-t {tag} \"{dockerFile}\"", workingDirectory, context.CancellationToken); | ||
return await ExecuteDockerCommandAsync(context, "build", $"-t {tag} -f \"{dockerFile}\" {dockerContext}", workingDirectory, context.CancellationToken); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to quote {dockerContext}
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably. It works either way with my samples but I think if theres a whitespace or maybe other weird characters in the path it could get split / not work without quotes so I added them
ExecutionContext, | ||
ExecutionContext.GetGitHubContext("workspace"), | ||
dockerFile, | ||
Directory.GetParent(dockerFile).FullName, imageName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imageName
on the newline. 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
* pass -f to docker build * Wrong place * build path * Also pass docker context path * Tidy up format * PR Feedback
This lets you specify
image: './path/to/dockerfile.Dockerfile
instead of requiring the filename to be justDockerfile
.Passes the existing filename to
build
explicitly with-f
but continues passing the directory containing the dockerfile to indicate the docker context, rather than assuming it will contain "Dockerfile" by default.e.g. in an action you can now have (under image):