mirror of
https://github.com/docker/compose.git
synced 2026-08-28 04:18:05 +00:00
Implement --domainname flag on compose up, also defining compose extension "x-aci-domain-name" to store ACI DNSLabelName.
Signed-off-by: Guillaume Tardif <guillaume.tardif@docker.com>
This commit is contained in:
parent
268c02523a
commit
334ebf5f75
5 changed files with 67 additions and 26 deletions
|
|
@ -29,6 +29,7 @@ import (
|
|||
|
||||
type composeOptions struct {
|
||||
Name string
|
||||
DomainName string
|
||||
WorkingDir string
|
||||
ConfigPaths []string
|
||||
Environment []string
|
||||
|
|
@ -60,7 +61,7 @@ func (o *composeOptions) toProjectOptions() (*cli.ProjectOptions, error) {
|
|||
}
|
||||
|
||||
// Command returns the compose command with its child commands
|
||||
func Command() *cobra.Command {
|
||||
func Command(contextType string) *cobra.Command {
|
||||
command := &cobra.Command{
|
||||
Short: "Docker Compose",
|
||||
Use: "compose",
|
||||
|
|
@ -70,7 +71,7 @@ func Command() *cobra.Command {
|
|||
}
|
||||
|
||||
command.AddCommand(
|
||||
upCommand(),
|
||||
upCommand(contextType),
|
||||
downCommand(),
|
||||
psCommand(),
|
||||
listCommand(),
|
||||
|
|
|
|||
|
|
@ -20,14 +20,15 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/compose-spec/compose-go/cli"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
aciconvert "github.com/docker/compose-cli/aci/convert"
|
||||
"github.com/docker/compose-cli/api/client"
|
||||
"github.com/docker/compose-cli/context/store"
|
||||
"github.com/docker/compose-cli/progress"
|
||||
)
|
||||
|
||||
func upCommand() *cobra.Command {
|
||||
func upCommand(contextType string) *cobra.Command {
|
||||
opts := composeOptions{}
|
||||
upCmd := &cobra.Command{
|
||||
Use: "up",
|
||||
|
|
@ -40,6 +41,11 @@ func upCommand() *cobra.Command {
|
|||
upCmd.Flags().StringArrayVarP(&opts.ConfigPaths, "file", "f", []string{}, "Compose configuration files")
|
||||
upCmd.Flags().StringArrayVarP(&opts.Environment, "environment", "e", []string{}, "Environment variables")
|
||||
upCmd.Flags().BoolP("detach", "d", true, " Detached mode: Run containers in the background")
|
||||
|
||||
if contextType == store.AciContextType {
|
||||
upCmd.Flags().StringVar(&opts.DomainName, "domainname", "", "Container NIS domain name")
|
||||
}
|
||||
|
||||
return upCmd
|
||||
}
|
||||
|
||||
|
|
@ -55,6 +61,9 @@ func runUp(ctx context.Context, opts composeOptions) error {
|
|||
return "", err
|
||||
}
|
||||
project, err := cli.ProjectFromOptions(options)
|
||||
if opts.DomainName != "" {
|
||||
project.Extensions = map[string]interface{}{aciconvert.ExtensionDomainName: opts.DomainName}
|
||||
}
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue