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

mkctr: add flag to save image/images to disk #25

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kradalby
Copy link
Member

This commit adds a new flag, --out-path which will allow the user to write the image to disk;

if building a single image, e.g. with --target local, a tar is created at the out-path.

if building a multi arch image, then a directorty is
created with the images and oci manifest.

@kradalby kradalby requested review from irbekrm, tomhjp and knyar January 29, 2025 17:11
mkctr.go Outdated
@@ -96,6 +98,7 @@ func main() {
ldflagsArg = flag.String("ldflags", "", "the --ldflags value to pass to go")
gotags = flag.String("gotags", "", "the --tags value to pass to go")
push = flag.Bool("push", false, "publish the image")
outPath = flag.String("out-path", "", "write single images to a tarball, or multi-platform images to a folder")
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you need the single file path option? Can't we have a single --dst flag that takes a directory arg and writes either one or many files to that directory depending on whether it's a multi-arch or not?

Copy link
Contributor

Choose a reason for hiding this comment

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

Feels like that would simplify the UX

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

This commit adds a new flag, --out-path which will
allow the user to write the image to disk;

if building a single image, e.g. with --target local,
a tar is created at the out-path.

if building a multi arch image, then a directorty is
  created with the images and oci manifest.

Signed-off-by: Kristoffer Dalby <[email protected]>
@kradalby kradalby force-pushed the kradalby/image-to-file branch from 975889b to db82727 Compare January 30, 2025 15:21
@kradalby kradalby requested a review from irbekrm January 30, 2025 15:21
Copy link
Contributor

@irbekrm irbekrm left a comment

Choose a reason for hiding this comment

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

Thanks Kristoffer, this looks good to me!

As an optional improvement, might also validate that both --push=true and --out flags are not passed at the same time.
But happy for this to go in either way

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