Skip to content
Docs Try Aspire

Build

Class sealed net10.0
📦 Aspire.Hosting.Docker v13.1.2-preview.1.26125.13
Represents the build configuration for a service within a Docker Compose file. This class is used to define various build parameters such as context, dockerfile, arguments, target stages, cache sources, and labels.
namespace Aspire.Hosting.Docker.Resources.ServiceNodes;
public sealed class Build
{
// ...
}
View all constructors
Argsget; set
Dictionary<string, string>
Gets or sets a dictionary of build arguments for the Docker image. Build arguments provide values that can be passed to the Dockerfile during the build process. These arguments allow customization of the build process by defining key-value pairs that are accessible within the Dockerfile.
CacheFromget; set
List<string>
Gets or sets a list of cache sources to be used during the build process. This property corresponds to the "cache_from" field in a Docker Compose build configuration and allows specifying external images or sources to use as a cache for layers during Docker image builds.
Contextget; set
string?
Gets or sets the build context for the service in the Docker Compose file. The context specifies the directory containing the Dockerfile and other resources needed for building the image.
Dockerfileget; set
string?
Specifies the path to the Dockerfile used for building the Docker image. This property points to the Dockerfile that contains the instructions for building the service image in a Docker Compose configuration.
Labelsget; set
Dictionary<string, string>
Gets or sets the collection of additional labels to be applied to the build. Labels are key-value pairs that provide metadata about the build.
Targetget; set
string?
Specifies the target build stage to be used from a multi-stage Dockerfile. This property allows defining a specific target stage name, enabling partial builds and optimizing the build process by selecting only the required build stage.
View all properties