github.com/docker/libcompose@v0.4.1-0.20210616120443-2a046c0bdbf2/example/main.go (about)

     1  package main
     2  
     3  import (
     4  	"log"
     5  
     6  	"golang.org/x/net/context"
     7  
     8  	"github.com/docker/libcompose/docker"
     9  	"github.com/docker/libcompose/docker/ctx"
    10  	"github.com/docker/libcompose/project"
    11  	"github.com/docker/libcompose/project/options"
    12  )
    13  
    14  func main() {
    15  	project, err := docker.NewProject(&ctx.Context{
    16  		Context: project.Context{
    17  			ComposeFiles: []string{"docker-compose.yml"},
    18  			ProjectName:  "yeah-compose",
    19  		},
    20  	}, nil)
    21  
    22  	if err != nil {
    23  		log.Fatal(err)
    24  	}
    25  
    26  	err = project.Up(context.Background(), options.Up{})
    27  
    28  	if err != nil {
    29  		log.Fatal(err)
    30  	}
    31  }