MCPcopy Index your code
hub / github.com/dagger/dagger / Container

Method Container

toolchains/engine-dev/main.go:143–208  ·  view source on GitHub ↗

Build the engine container

(
	ctx context.Context,

	// +optional
	platform dagger.Platform,
	// +optional
	gpuSupport bool,
	// +optional
	version string,
	// +optional
	tag string,
)

Source from the content-addressed store, hash-verified

141
142// Build the engine container
143func (dev *EngineDev) Container(
144 ctx context.Context,
145
146 // +optional
147 platform dagger.Platform,
148 // +optional
149 gpuSupport bool,
150 // +optional
151 version string,
152 // +optional
153 tag string,
154) (*dagger.Container, error) {
155 cfg, err := generateConfig(dev.LogLevel)
156 if err != nil {
157 return nil, err
158 }
159 engineTOML, err := generateEngineTOML(dev.EngineConfig)
160 if err != nil {
161 return nil, err
162 }
163 entrypoint, err := generateEntrypoint()
164 if err != nil {
165 return nil, err
166 }
167
168 builder, err := build.NewBuilder(ctx, dev.Source, version, tag)
169 if err != nil {
170 return nil, err
171 }
172 builder = builder.WithRace(dev.Race)
173 if platform != "" {
174 builder = builder.WithPlatform(platform)
175 }
176
177 if gpuSupport {
178 builder = builder.WithGPUSupport()
179 }
180
181 ctr, err := builder.Engine(ctx)
182 if err != nil {
183 return nil, err
184 }
185 for _, prog := range dev.EBPFProgs {
186 ctr = ctr.WithEnvVariable("DAGGER_EBPF_PROG_"+strings.ToUpper(prog), "y")
187 }
188
189 ctr = ctr.
190 WithFile(engineJSONPath, cfg).
191 WithFile(engineTOMLPath, engineTOML).
192 WithFile(engineEntrypointPath, entrypoint).
193 WithEntrypoint([]string{filepath.Base(engineEntrypointPath)})
194
195 cli := dag.DaggerCli(dagger.DaggerCliOpts{
196 Version: version,
197 ImageTag: tag,
198 }).Binary(dagger.DaggerCliBinaryOpts{
199 Platform: platform,
200 })

Callers 11

LoadToDockerMethod · 0.95
ServiceMethod · 0.95
buildTargetsMethod · 0.95
invokeFunction · 0.45
testMethod · 0.45
testContainerMethod · 0.45
registryFunction · 0.45
privateRegistryFunction · 0.45
fetchDumpFunction · 0.45
PlaygroundMethod · 0.45
pushTargetsMethod · 0.45

Calls 11

generateConfigFunction · 0.85
generateEngineTOMLFunction · 0.85
generateEntrypointFunction · 0.85
EngineMethod · 0.65
WithRaceMethod · 0.45
WithEnvVariableMethod · 0.45
WithEntrypointMethod · 0.45
WithFileMethod · 0.45
BaseMethod · 0.45
BinaryMethod · 0.45
DaggerCliMethod · 0.45

Tested by

no test coverage detected