Share via


Build Class

Definition

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.

[YamlDotNet.Serialization.YamlSerializable]
public sealed class Build
[<YamlDotNet.Serialization.YamlSerializable>]
type Build = class
Public NotInheritable Class Build
Inheritance
Build
Attributes
YamlDotNet.Serialization.YamlSerializableAttribute

Constructors

Build()

Properties

Args

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.

CacheFrom

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.

Context

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.

Dockerfile

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.

Labels

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.

Target

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.

Applies to