Share via


DockerfileStage Class

Definition

Represents a stage within a multi-stage Dockerfile.

public class DockerfileStage : Aspire.Hosting.ApplicationModel.Docker.DockerfileStatement
type DockerfileStage = class
    inherit DockerfileStatement
Public Class DockerfileStage
Inherits DockerfileStatement
Inheritance
DockerfileStage

Constructors

DockerfileStage(String, String)

Initializes a new instance of the DockerfileStage class.

Properties

StageName

Gets the name of the stage.

Statements

Gets the statements for this stage.

Methods

Arg(String, String)

Adds an ARG statement to define a build-time variable with a default value.

Arg(String)

Adds an ARG statement to define a build-time variable.

Cmd(String[])

Adds a CMD statement to set the default command.

Comment(String)

Adds a comment to the Dockerfile. Multi-line comments are supported.

Copy(String, String, String)

Adds a COPY statement to copy files with ownership change.

Copy(String, String)

Adds a COPY statement to copy files from the build context.

CopyFrom(String, String, String, String)

Adds a COPY statement to copy files from another stage with ownership change.

CopyFrom(String, String, String)

Adds a COPY statement to copy files from another stage.

EmptyLine()

Adds an empty line to the Dockerfile for better readability.

Entrypoint(String[])

Adds an ENTRYPOINT statement to set the container entrypoint.

Env(String, String)

Adds an ENV statement to set an environment variable.

Expose(Int32)

Adds an EXPOSE statement to expose a port.

Run(String)

Adds a RUN statement to execute a command.

RunWithMounts(String, String[])

Adds a RUN statement with mount options for BuildKit.

User(String)

Adds a USER statement to set the user for subsequent commands.

WorkDir(String)

Adds a WORKDIR statement to set the working directory.

WriteStatementAsync(StreamWriter, CancellationToken)

Writes the statement to the specified writer.

Extension Methods

AddContainerFiles(DockerfileStage, IResource, String, ILogger)

Adds COPY --from statements to the Dockerfile stage for container files from resources referenced by ContainerFilesDestinationAnnotation.

Applies to