-
Notifications
You must be signed in to change notification settings - Fork 43
feat: allow custom build context to be configured when using DOCKERFILE_PATH
#139
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
Conversation
…e base workspace dir Signed-off-by: Danny Kopping <[email protected]>
Signed-off-by: Danny Kopping <[email protected]>
Signed-off-by: Danny Kopping <[email protected]>
Signed-off-by: Danny Kopping <[email protected]>
}, | ||
{ | ||
// Dockerfile & build context are not in the same dir, but inclFile is in the default build context dir; | ||
// this should allow inclFile to be copied. This is probably not desirable though? |
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.
Reviewer: should we warn when a Dockerfile is used outside the WorkspaceFolder
, because the build context will likely be wrong?
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.
You could also make an argument for failing the build entirely; but I think warning is fine here.
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.
LGTM, just one question.
@@ -476,7 +480,7 @@ func Run(ctx context.Context, options Options) error { | |||
buildParams = &devcontainer.Compiled{ | |||
DockerfilePath: dockerfilePath, | |||
DockerfileContent: string(content), | |||
BuildContext: options.WorkspaceFolder, | |||
BuildContext: filepath.Join(options.WorkspaceFolder, options.BuildContextPath), |
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.
Since WorkspaceFolder
is optional, what's the end-result if it's not provided, will this be correct?
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.
WorkspaceFolder
will be given a default value if none is provided:
Lines 270 to 276 in 0643d17
if options.WorkspaceFolder == "" { | |
var err error | |
options.WorkspaceFolder, err = DefaultWorkspaceFolder(options.GitURL) | |
if err != nil { | |
return err | |
} | |
} |
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.
Awesome!
4bb1307
to
4dbe75b
Compare
Signed-off-by: Danny Kopping <[email protected]>
4dbe75b
to
73e8800
Compare
Fixes #129