Skip to content

Commit 1361875

Browse files
committed
make publish a regular command of Compose
Signed-off-by: Guillaume Lours <[email protected]>
1 parent 6c1e215 commit 1361875

File tree

6 files changed

+91
-3
lines changed

6 files changed

+91
-3
lines changed

cmd/compose/compose.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,7 @@ func RootCommand(dockerCli command.Cli, backend Backend) *cobra.Command { //noli
630630
scaleCommand(&opts, dockerCli, backend),
631631
statsCommand(&opts, dockerCli),
632632
watchCommand(&opts, dockerCli, backend),
633+
publishCommand(&opts, dockerCli, backend),
633634
alphaCommand(&opts, dockerCli, backend),
634635
)
635636

cmd/compose/publish.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ import (
2020
"context"
2121
"errors"
2222

23+
"github.com/docker/cli/cli"
2324
"github.com/docker/cli/cli/command"
25+
"github.com/docker/compose/v2/pkg/api"
2426
"github.com/sirupsen/logrus"
2527
"github.com/spf13/cobra"
2628
"github.com/spf13/pflag"
27-
28-
"github.com/docker/compose/v2/pkg/api"
2929
)
3030

3131
type publishOptions struct {
@@ -46,7 +46,7 @@ func publishCommand(p *ProjectOptions, dockerCli command.Cli, backend api.Servic
4646
RunE: Adapt(func(ctx context.Context, args []string) error {
4747
return runPublish(ctx, dockerCli, backend, opts, args[0])
4848
}),
49-
Args: cobra.ExactArgs(1),
49+
Args: cli.ExactArgs(1),
5050
}
5151
flags := cmd.Flags()
5252
flags.BoolVar(&opts.resolveImageDigests, "resolve-image-digests", false, "Pin image tags to digests")

docs/reference/compose.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Define and run multi-container applications with Docker
2828
| [`pause`](compose_pause.md) | Pause services |
2929
| [`port`](compose_port.md) | Print the public port for a port binding |
3030
| [`ps`](compose_ps.md) | List containers |
31+
| [`publish`](compose_publish.md) | Publish compose application |
3132
| [`pull`](compose_pull.md) | Pull service images |
3233
| [`push`](compose_push.md) | Push service images |
3334
| [`restart`](compose_restart.md) | Restart service containers |

docs/reference/compose_publish.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# docker compose publish
2+
3+
<!---MARKER_GEN_START-->
4+
Publish compose application
5+
6+
### Options
7+
8+
| Name | Type | Default | Description |
9+
|:--------------------------|:---------|:--------|:-------------------------------------------------------------------------------|
10+
| `--dry-run` | `bool` | | Execute command in dry run mode |
11+
| `--oci-version` | `string` | | OCI image/artifact specification version (automatically determined by default) |
12+
| `--resolve-image-digests` | `bool` | | Pin image tags to digests |
13+
| `--with-env` | `bool` | | Include environment variables in the published OCI artifact |
14+
| `-y`, `--yes` | `bool` | | Assume "yes" as answer to all prompts |
15+
16+
17+
<!---MARKER_GEN_END-->
18+

docs/reference/docker_compose.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ cname:
2222
- docker compose pause
2323
- docker compose port
2424
- docker compose ps
25+
- docker compose publish
2526
- docker compose pull
2627
- docker compose push
2728
- docker compose restart
@@ -55,6 +56,7 @@ clink:
5556
- docker_compose_pause.yaml
5657
- docker_compose_port.yaml
5758
- docker_compose_ps.yaml
59+
- docker_compose_publish.yaml
5860
- docker_compose_pull.yaml
5961
- docker_compose_push.yaml
6062
- docker_compose_restart.yaml
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
command: docker compose publish
2+
short: Publish compose application
3+
long: Publish compose application
4+
usage: docker compose publish [OPTIONS] REPOSITORY[:TAG]
5+
pname: docker compose
6+
plink: docker_compose.yaml
7+
options:
8+
- option: oci-version
9+
value_type: string
10+
description: |
11+
OCI image/artifact specification version (automatically determined by default)
12+
deprecated: false
13+
hidden: false
14+
experimental: false
15+
experimentalcli: false
16+
kubernetes: false
17+
swarm: false
18+
- option: resolve-image-digests
19+
value_type: bool
20+
default_value: "false"
21+
description: Pin image tags to digests
22+
deprecated: false
23+
hidden: false
24+
experimental: false
25+
experimentalcli: false
26+
kubernetes: false
27+
swarm: false
28+
- option: with-env
29+
value_type: bool
30+
default_value: "false"
31+
description: Include environment variables in the published OCI artifact
32+
deprecated: false
33+
hidden: false
34+
experimental: false
35+
experimentalcli: false
36+
kubernetes: false
37+
swarm: false
38+
- option: "yes"
39+
shorthand: "y"
40+
value_type: bool
41+
default_value: "false"
42+
description: Assume "yes" as answer to all prompts
43+
deprecated: false
44+
hidden: false
45+
experimental: false
46+
experimentalcli: false
47+
kubernetes: false
48+
swarm: false
49+
inherited_options:
50+
- option: dry-run
51+
value_type: bool
52+
default_value: "false"
53+
description: Execute command in dry run mode
54+
deprecated: false
55+
hidden: false
56+
experimental: false
57+
experimentalcli: false
58+
kubernetes: false
59+
swarm: false
60+
deprecated: false
61+
hidden: false
62+
experimental: false
63+
experimentalcli: false
64+
kubernetes: false
65+
swarm: false
66+

0 commit comments

Comments
 (0)