Build an ephemeral environment with the Dagger CLI and engine built from source, installed and ready to use
( ctx context.Context, // Build from a custom base image // +optional base *dagger.Container, // Enable experimental GPU support // +optional gpuSupport bool, // Share cache globally // +optional sharedCache bool, // +optional metrics bool, //+optional version string, )
| 103 | |
| 104 | // Build an ephemeral environment with the Dagger CLI and engine built from source, installed and ready to use |
| 105 | func (dev *EngineDev) Playground( |
| 106 | ctx context.Context, |
| 107 | // Build from a custom base image |
| 108 | // +optional |
| 109 | base *dagger.Container, |
| 110 | // Enable experimental GPU support |
| 111 | // +optional |
| 112 | gpuSupport bool, |
| 113 | // Share cache globally |
| 114 | // +optional |
| 115 | sharedCache bool, |
| 116 | // +optional |
| 117 | metrics bool, |
| 118 | //+optional |
| 119 | version string, |
| 120 | ) (*dagger.Container, error) { |
| 121 | ctr := base |
| 122 | if ctr == nil { |
| 123 | ctr = dag.Wolfi().Container(dagger.WolfiContainerOpts{ |
| 124 | Packages: []string{"apk-tools", "git"}, |
| 125 | }).WithEnvVariable("HOME", "/root") |
| 126 | } |
| 127 | ctr = ctr.WithWorkdir("$HOME", dagger.ContainerWithWorkdirOpts{Expand: true}) |
| 128 | svc, err := dev.Service( |
| 129 | ctx, |
| 130 | "", // name |
| 131 | gpuSupport, |
| 132 | sharedCache, |
| 133 | metrics, |
| 134 | version, |
| 135 | ) |
| 136 | if err != nil { |
| 137 | return nil, err |
| 138 | } |
| 139 | return dev.InstallClient(ctx, ctr, svc, version) |
| 140 | } |
| 141 | |
| 142 | // Build the engine container |
| 143 | func (dev *EngineDev) Container( |
no test coverage detected