DockerfileFactoryContext Properties
Class Properties 3 members
Provides context for Dockerfile factory functions.
Gets the cancellation token for the operation.
public CancellationToken CancellationToken { get; init; } Gets the resource for which the Dockerfile is being generated.
This allows factory functions to query resource annotations and properties to customize the generated Dockerfile.
var containerAnnotation = context .Resource .Annotations .OfType<ContainerImageAnnotation>( ).FirstOrDefault();var baseImage = containerAnnotation?.Image ?? "alpine:latest";public IResource Resource { get; init; } Gets the
IServiceProvider for resolving dependencies required by Dockerfile factory functions. The service provider typically contains services such as IHostEnvironment, ILogger, and configuration objects relevant to the application model. Factory functions can use this provider to obtain required services for generating Dockerfiles.
var logger = context.Services.GetRequiredService<ILogger>();public IServiceProvider Services { get; init; }