Esempio n. 1
0
func injectBuildArgs(application *model.Application, compose *model.Compose) error {
	args, err := application.BuildArgs()

	if err != nil {
		return err
	}

	compose.InjectBuildArgs(args)

	return nil
}
Esempio n. 2
0
func injectEnvironmentVariables(application *model.Application, compose *model.Compose) error {
	envs, err := application.EnvironmentVariables()

	if err != nil {
		return err
	}

	compose.InjectEnvironmentVariables(envs)

	return nil
}
Esempio n. 3
0
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
}
Esempio n. 4
0
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
}