github.com/ajspeck/libcompose@v0.5.4/project/project_up.go (about)

     1  package project
     2  
     3  import (
     4  	"golang.org/x/net/context"
     5  
     6  	"github.com/ajspeck/libcompose/project/events"
     7  	"github.com/ajspeck/libcompose/project/options"
     8  )
     9  
    10  // Up creates and starts the specified services (kinda like docker run).
    11  func (p *Project) Up(ctx context.Context, options options.Up, services ...string) error {
    12  	if err := p.initialize(ctx); err != nil {
    13  		return err
    14  	}
    15  	return p.perform(events.ProjectUpStart, events.ProjectUpDone, services, wrapperAction(func(wrapper *serviceWrapper, wrappers map[string]*serviceWrapper) {
    16  		wrapper.Do(wrappers, events.ServiceUpStart, events.ServiceUp, func(service Service) error {
    17  			return service.Up(ctx, options)
    18  		})
    19  	}), func(service Service) error {
    20  		return service.Create(ctx, options.Create)
    21  	})
    22  }