2022-10-30 18:33:59 +01:00
|
|
|
package builder
|
2022-10-29 18:00:16 +02:00
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2022-10-29 22:23:06 +02:00
|
|
|
"os"
|
2022-10-29 18:00:16 +02:00
|
|
|
|
|
|
|
"dagger.io/dagger"
|
|
|
|
)
|
|
|
|
|
2022-10-29 22:23:06 +02:00
|
|
|
type Builder struct {
|
|
|
|
Dagger *dagger.Client
|
|
|
|
}
|
|
|
|
|
|
|
|
func New(ctx context.Context) (*Builder, error) {
|
2022-10-29 18:00:16 +02:00
|
|
|
client, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stdout))
|
|
|
|
if err != nil {
|
2022-10-29 22:23:06 +02:00
|
|
|
return nil, err
|
2022-10-29 18:00:16 +02:00
|
|
|
}
|
2022-10-29 22:23:06 +02:00
|
|
|
|
|
|
|
return &Builder{
|
|
|
|
Dagger: client,
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *Builder) CleanUp() error {
|
|
|
|
return b.Dagger.Close()
|
2022-10-29 18:00:16 +02:00
|
|
|
}
|