func injectBuildArgs(application *model.Application, compose *model.Compose) error { args, err := application.BuildArgs() if err != nil { return err } compose.InjectBuildArgs(args) return nil }
func injectEnvironmentVariables(application *model.Application, compose *model.Compose) error { envs, err := application.EnvironmentVariables() if err != nil { return err } compose.InjectEnvironmentVariables(envs) return nil }
func deploy(application *model.Application, compose *model.Compose) (string, error) { var err error fmt.Println("=====> Building ...") if err = compose.Build(); err != nil { return "", err } fmt.Println("=====> Pulling ...") if err = compose.Pull(); err != nil { return "", err } fmt.Println("=====> Deploying ...") if err = compose.Up(); err != nil { return "", err } webContainerID, err := compose.GetContainerID("web") if err != nil { return "", err } return webContainerID, nil }
func prepareComposeFile(application *model.Application, deployment *model.Deployment, compose *model.Compose) error { if err := injectBuildArgs(application, compose); err != nil { return err } if err := injectEnvironmentVariables(application, compose); err != nil { return err } compose.RewritePortBindings() if err := compose.SaveAs(deployment.ComposeFilePath); err != nil { return err } return nil }