-
Notifications
You must be signed in to change notification settings - Fork 9
mkctr: add support for volumes #27
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -86,6 +86,7 @@ type buildParams struct { | |||||||||||||||||||||||||
| target string | ||||||||||||||||||||||||||
| verbose bool | ||||||||||||||||||||||||||
| annotations map[string]string // OCI image annotations | ||||||||||||||||||||||||||
| volumes map[string]struct{} | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| func main() { | ||||||||||||||||||||||||||
|
|
@@ -94,6 +95,7 @@ func main() { | |||||||||||||||||||||||||
| gopaths = flag.String("gopaths", "", "comma-separated list of go paths in src:dst form") | ||||||||||||||||||||||||||
| files = flag.String("files", "", "comma-separated list of static files in src:dst form") | ||||||||||||||||||||||||||
| repos = flag.String("repos", "", "comma-separated list of image registries") | ||||||||||||||||||||||||||
| volumes = flag.String("volumes", "", "comma-separated list of volumes to add") | ||||||||||||||||||||||||||
| tagArg = flag.String("tags", "", "comma-separated tags") | ||||||||||||||||||||||||||
| ldflagsArg = flag.String("ldflags", "", "the --ldflags value to pass to go") | ||||||||||||||||||||||||||
| gotags = flag.String("gotags", "", "the --tags value to pass to go") | ||||||||||||||||||||||||||
|
|
@@ -136,6 +138,13 @@ func main() { | |||||||||||||||||||||||||
| if len(paths) == 0 && len(staticFiles) == 0 { | ||||||||||||||||||||||||||
| log.Fatal("at least one of --files or --gopaths must be set") | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| var vols map[string]struct{} | ||||||||||||||||||||||||||
| for vol := range strings.SplitSeq(*volumes, ",") { | ||||||||||||||||||||||||||
| if vols == nil { | ||||||||||||||||||||||||||
| vols = make(map[string]struct{}) | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| vols[strings.TrimSpace(vol)] = struct{}{} | ||||||||||||||||||||||||||
|
Comment on lines
+143
to
+146
|
||||||||||||||||||||||||||
| if vols == nil { | |
| vols = make(map[string]struct{}) | |
| } | |
| vols[strings.TrimSpace(vol)] = struct{}{} | |
| vol = strings.TrimSpace(vol) | |
| if vol == "" { | |
| continue | |
| } | |
| if vols == nil { | |
| vols = make(map[string]struct{}) | |
| } | |
| vols[vol] = struct{}{} |
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.
This part shouldn't be conditional on len(args) > 0 (setting an entrypoint)
I noted this in my upcoming PR to add env var support too.
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.
I'll handle this fix in my upcoming PR.
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.
this requires Go 1.24. But the go.mod still says 1.23.
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.
Fixed go.mod in #31