# withDockerfile

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

Configures the resource to use a Dockerfile

## Definition

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

## Parameters

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

## Returns

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

## Applies to

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