DockerfileBuilder Methods
Class Methods 5 members
Builder for creating Dockerfiles programmatically.
Adds a global ARG statement to define a build-time variable before any stages.
public class DockerfileBuilder{ public DockerfileBuilder Arg( string name) { // ... }}Parameters
name string The name of the build argument. Returns
DockerfileBuilder The current DockerfileBuilder instance for method chaining. Remarks
Global ARG statements appear before the first FROM statement and can be used to parameterize the base image selection.
Adds a global ARG statement to define a build-time variable with a default value before any stages.
public class DockerfileBuilder{ public DockerfileBuilder Arg( string name, string defaultValue) { // ... }}Parameters
name string The name of the build argument. defaultValue string The default value for the build argument. Returns
DockerfileBuilder The current DockerfileBuilder instance for method chaining. Remarks
Global ARG statements appear before the first FROM statement and can be used to parameterize the base image selection.
Adds a FROM statement to start a new named stage.
public class DockerfileBuilder{ public DockerfileStage From( string image, string stageName) { // ... }}Parameters
image string The image reference (e.g., 'node:18' or 'alpine:latest'). stageName string The stage name for multi-stage builds. Returns
DockerfileStage A stage builder for the new stage. Adds a FROM statement to start a new stage.
public class DockerfileBuilder{ public DockerfileStage From( string image) { // ... }}Parameters
image string The image reference (e.g., 'node:18' or 'alpine:latest'). Returns
DockerfileStage A stage builder for the new stage. WriteAsync(StreamWriter, CancellationToken) Section titled WriteAsync(StreamWriter, CancellationToken) Task Writes the Dockerfile content to the specified
IO.StreamWriter. public class DockerfileBuilder{ public Task WriteAsync( StreamWriter writer, CancellationToken cancellationToken = default(CancellationToken)) { // ... }}Parameters
writer StreamWriter The IO.StreamWriter to write to. cancellationToken CancellationToken optional A cancellation token. Returns
Task A task representing the asynchronous write operation.