DockerfileBuilder Methods
ClassMethods5 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
namestringThe name of the build argument.Returns
DockerfileBuilderThe 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
namestringThe name of the build argument.defaultValuestringThe default value for the build argument.Returns
DockerfileBuilderThe 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
imagestringThe image reference (e.g., 'node:18' or 'alpine:latest').stageNamestringThe stage name for multi-stage builds.Returns
DockerfileStageA stage builder for the new stage. Adds a FROM statement to start a new stage.
public class DockerfileBuilder{ public DockerfileStage From( string image) { // ... }}Parameters
imagestringThe image reference (e.g., 'node:18' or 'alpine:latest').Returns
DockerfileStageA 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
writerStreamWriterThe IO.StreamWriter to write to.cancellationTokenCancellationTokenoptionalA cancellation token.Returns
TaskA task representing the asynchronous write operation.