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

dockerfile from stdin #440

Merged
merged 2 commits into from
Oct 20, 2021
Merged

Conversation

fahedouch
Copy link
Member

fixing #387

Signed-off-by: fahed dorgaa fahed.dorgaa@gmail.com

@AkihiroSuda AkihiroSuda added this to the v0.13.0 milestone Oct 18, 2021
if err != nil {
return err
}

defer os.RemoveAll(tempDockerfile)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: only if tempDockerfile != ""

dir, file = filepath.Split(filename)
}

if dockerfileReader != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can merge this if dockerfileReader != nil to if filename == "-"

return "", nil, false, "", err
}
file = buildkitutil.DefaultDockerfileName
tempDockerfile = dir
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tempDockerfile looks misnomer. Probably called like tempDockerfileDir

CMD ["echo", "nerdctl-build-test-stdin"]
`, testutil.AlpineImage)

base.Cmd("build", "-t", imageName, "-f", "-", ".").CmdOption(testutil.WithStdin(strings.NewReader(dockerfile))).AssertOK()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AssertOut("nerdctl-build-test-stdin")

@@ -118,50 +121,51 @@ func buildAction(cmd *cobra.Command, args []string) error {
return nil
}

func generateBuildctlArgs(cmd *cobra.Command, args []string) (string, []string, bool, error) {
func generateBuildctlArgs(cmd *cobra.Command, args []string) (string, []string, bool, string, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably return cleanup func() error rather than string

Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@AkihiroSuda
Copy link
Member

Please squash commits

@fahedouch fahedouch force-pushed the build-from-stdin branch 2 times, most recently from e00d10f to 6c483da Compare October 19, 2021 12:25
@fahedouch
Copy link
Member Author

@AkihiroSuda done

@fahedouch fahedouch force-pushed the build-from-stdin branch 3 times, most recently from d773d34 to 8ac9454 Compare October 19, 2021 13:19
Signed-off-by: fahed dorgaa <fahed.dorgaa@gmail.com>
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
@AkihiroSuda
Copy link
Member

LGTM, thanks.

Added a commit to use a permalink in pkg/buildkitutil.

@AkihiroSuda AkihiroSuda merged commit 29f5c8d into containerd:master Oct 20, 2021
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