MCPcopy
hub / github.com/docker/compose / publishCommand

Function publishCommand

cmd/compose/publish.go:43–74  ·  view source on GitHub ↗
(p *ProjectOptions, dockerCli command.Cli, backendOptions *BackendOptions)

Source from the content-addressed store, hash-verified

41}
42
43func publishCommand(p *ProjectOptions, dockerCli command.Cli, backendOptions *BackendOptions) *cobra.Command {
44 opts := publishOptions{
45 ProjectOptions: p,
46 }
47 cmd := &cobra.Command{
48 Use: "publish [OPTIONS] REPOSITORY[:TAG]",
49 Short: "Publish compose application",
50 RunE: Adapt(func(ctx context.Context, args []string) error {
51 return runPublish(ctx, dockerCli, backendOptions, opts, args[0])
52 }),
53 Args: cli.ExactArgs(1),
54 }
55 flags := cmd.Flags()
56 flags.BoolVar(&opts.resolveImageDigests, "resolve-image-digests", false, "Pin image tags to digests")
57 flags.StringVar(&opts.ociVersion, "oci-version", "", "OCI image/artifact specification version (automatically determined by default)")
58 flags.BoolVar(&opts.withEnvironment, "with-env", false, "Include environment variables in the published OCI artifact")
59 flags.BoolVarP(&opts.assumeYes, "yes", "y", false, `Assume "yes" as answer to all prompts`)
60 flags.BoolVar(&opts.app, "app", false, "Published compose application (includes referenced images)")
61 flags.BoolVar(&opts.insecureRegistry, "insecure-registry", false, "Use insecure registry")
62 flags.SetNormalizeFunc(func(f *pflag.FlagSet, name string) pflag.NormalizedName {
63 // assumeYes was introduced by mistake as `--y`
64 if name == "y" {
65 logrus.Warn("--y is deprecated, please use --yes instead")
66 name = "yes"
67 }
68 return pflag.NormalizedName(name)
69 })
70 // Should **only** be used for testing purpose, we don't want to promote use of insecure registries
71 _ = flags.MarkHidden("insecure-registry")
72
73 return cmd
74}
75
76func runPublish(ctx context.Context, dockerCli command.Cli, backendOptions *BackendOptions, opts publishOptions, repository string) error {
77 if opts.assumeYes {

Callers 2

RootCommandFunction · 0.85
alphaCommandFunction · 0.85

Calls 2

AdaptFunction · 0.85
runPublishFunction · 0.85

Tested by

no test coverage detected