# addDockerfile

- Module: [Aspire.Hosting](/reference/api/typescript/aspire.hosting.md)
- Version: `13.2.0`
- Kind: `method`
- Source: [GitHub](https://github.com/microsoft/aspire)

Adds a container resource built from a Dockerfile

## Definition

```typescript
interface IDistributedApplicationBuilder {
  // ... omitted for brevity
  addDockerfile(
    name: string,
    contextPath: string,
    dockerfilePath?: string,
    stage?: string): ContainerResource
}
```

## Parameters

- `name` (`string`)
- `contextPath` (`string`)
- `dockerfilePath` (`string`) `optional`
- `stage` (`string`) `optional`

## Returns

[ContainerResource](/reference/api/typescript/aspire.hosting/containerresource.md) `builder`

## Applies to

- [IDistributedApplicationBuilder](/reference/api/typescript/aspire.hosting/idistributedapplicationbuilder.md)
