# DockerfileBuildAnnotation Properties

- Package: [Aspire.Hosting](/reference/api/csharp/aspire.hosting.md)
- Type: [DockerfileBuildAnnotation](/reference/api/csharp/aspire.hosting/dockerfilebuildannotation.md)
- Kind: `Properties`
- Members: `10`

Represents an annotation for customizing a Dockerfile build.

## BuildArguments

- Name: `BuildArguments`
- Modifiers: `get`
- Returns: `Dictionary<string, object?>`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/a3766e994fd2cba86c8ac60b8a80268cab7e6383/src/Aspire.Hosting/ApplicationModel/DockerfileBuildAnnotation.cs#L35)

Gets the arguments to pass to the build.

```csharp
public Dictionary<string, object?> BuildArguments { get; }
```

## BuildContextIgnoreContent

- Name: `BuildContextIgnoreContent`
- Modifiers: `nullable` `get; set`
- Returns: `string?`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/a3766e994fd2cba86c8ac60b8a80268cab7e6383/src/Aspire.Hosting/ApplicationModel/DockerfileBuildAnnotation.cs)

Gets or sets the default `.dockerignore` content to emit alongside the published Dockerfile using BuildKit's per-Dockerfile ignore convention ( `<dockerfile-name>.dockerignore` next to the Dockerfile).

```csharp
public string? BuildContextIgnoreContent { get; set; }
```

## Remarks

When the build context root already contains a `.dockerignore` authored by the user, generated per-Dockerfile files are removed so the user's file is honored. User-authored per-Dockerfile ignore files are preserved because BuildKit gives them precedence over the context-root file. See https://docs.docker.com/build/concepts/context/#filename-and-location.

## BuildSecrets

- Name: `BuildSecrets`
- Modifiers: `get`
- Returns: `Dictionary<string, object>`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/a3766e994fd2cba86c8ac60b8a80268cab7e6383/src/Aspire.Hosting/ApplicationModel/DockerfileBuildAnnotation.cs#L40)

Gets the secrets to pass to the build.

```csharp
public Dictionary<string, object> BuildSecrets { get; }
```

## ContextPath

- Name: `ContextPath`
- Modifiers: `get`
- Returns: `string`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/a3766e994fd2cba86c8ac60b8a80268cab7e6383/src/Aspire.Hosting/ApplicationModel/DockerfileBuildAnnotation.cs#L20)

Gets the path to the context directory for the build.

```csharp
public string ContextPath { get; }
```

## DockerfileFactory

- Name: `DockerfileFactory`
- Modifiers: `nullable` `get; init`
- Returns: `Func<DockerfileFactoryContext, Task<string>>`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/a3766e994fd2cba86c8ac60b8a80268cab7e6383/src/Aspire.Hosting/ApplicationModel/DockerfileBuildAnnotation.cs)

Gets or sets the factory function that generates Dockerfile content dynamically. When set, this factory will be invoked to generate the Dockerfile content at build time, and the content will be written to a generated file path.

```csharp
public Func<DockerfileFactoryContext, Task<string>>? DockerfileFactory { get; init; }
```

## DockerfilePath

- Name: `DockerfilePath`
- Modifiers: `get`
- Returns: `string`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/a3766e994fd2cba86c8ac60b8a80268cab7e6383/src/Aspire.Hosting/ApplicationModel/DockerfileBuildAnnotation.cs#L25)

Gets the path to the Dockerfile to use for the build.

```csharp
public string DockerfilePath { get; }
```

## HasEntrypoint

- Name: `HasEntrypoint`
- Modifiers: `get; set`
- Returns: `bool`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/a3766e994fd2cba86c8ac60b8a80268cab7e6383/src/Aspire.Hosting/ApplicationModel/DockerfileBuildAnnotation.cs)

Gets or sets a value indicating whether an entry point is defined in the Dockerfile.

```csharp
public bool HasEntrypoint { get; set; }
```

## Remarks

Container images without an entry point are not considered compute resources.

## ImageName

- Name: `ImageName`
- Modifiers: `nullable` `get; set`
- Returns: `string?`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/a3766e994fd2cba86c8ac60b8a80268cab7e6383/src/Aspire.Hosting/ApplicationModel/DockerfileBuildAnnotation.cs)

Gets or sets the image name for the generated container image. When set, this will be used as the container image name instead of the value from ContainerImageAnnotation.

```csharp
public string? ImageName { get; set; }
```

## ImageTag

- Name: `ImageTag`
- Modifiers: `nullable` `get; set`
- Returns: `string?`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/a3766e994fd2cba86c8ac60b8a80268cab7e6383/src/Aspire.Hosting/ApplicationModel/DockerfileBuildAnnotation.cs)

Gets or sets the image tag for the generated container image. When set, this will be used as the container image tag instead of the value from ContainerImageAnnotation.

```csharp
public string? ImageTag { get; set; }
```

## Stage

- Name: `Stage`
- Modifiers: `nullable` `get`
- Returns: `string?`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/a3766e994fd2cba86c8ac60b8a80268cab7e6383/src/Aspire.Hosting/ApplicationModel/DockerfileBuildAnnotation.cs#L30)

Gets the name of the build stage to use for the build.

```csharp
public string? Stage { get; }
```
