No rebuild on compose up if image already exists by default, added first use of compose pull_policy and compose up --build to allow to force rebuild.

Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
This commit is contained in:
Guillaume Tardif 2020-12-10 10:22:18 +01:00
parent bb7b47be39
commit cf378834e5
6 changed files with 41 additions and 20 deletions

View file

@ -35,6 +35,7 @@ type composeOptions struct {
Environment []string
Format string
Detach bool
Build bool
Quiet bool
}

View file

@ -51,7 +51,8 @@ func upCommand(contextType string) *cobra.Command {
upCmd.Flags().StringVar(&opts.WorkingDir, "workdir", "", "Work dir")
upCmd.Flags().StringArrayVarP(&opts.ConfigPaths, "file", "f", []string{}, "Compose configuration files")
upCmd.Flags().StringArrayVarP(&opts.Environment, "environment", "e", []string{}, "Environment variables")
upCmd.Flags().BoolVarP(&opts.Detach, "detach", "d", false, " Detached mode: Run containers in the background")
upCmd.Flags().BoolVarP(&opts.Detach, "detach", "d", false, "Detached mode: Run containers in the background")
upCmd.Flags().BoolVar(&opts.Build, "build", false, "Build images before starting containers.")
if contextType == store.AciContextType {
upCmd.Flags().StringVar(&opts.DomainName, "domainname", "", "Container NIS domain name")
@ -119,6 +120,11 @@ func setup(ctx context.Context, opts composeOptions, services []string) (*client
// arbitrarily set the domain name on the first service ; ACI backend will expose the entire project
project.Services[0].DomainName = opts.DomainName
}
if opts.Build {
for _, service := range project.Services {
service.PullPolicy = types.PullPolicyBuild
}
}
err = filter(project, services)
if err != nil {