class DockerfileData
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.ImageBuilder.Alpha.DockerfileData |
Go | github.com/aws/aws-cdk-go/awsimagebuilderalpha/v2#DockerfileData |
Java | software.amazon.awscdk.services.imagebuilder.alpha.DockerfileData |
Python | aws_cdk.aws_imagebuilder_alpha.DockerfileData |
TypeScript (source) | @aws-cdk/aws-imagebuilder-alpha ยป DockerfileData |
Helper class for referencing and uploading dockerfile data for the container recipe.
Example
const containerRecipe = new imagebuilder.ContainerRecipe(this, 'CustomDockerfileContainerRecipe', {
baseImage: imagebuilder.BaseContainerImage.fromDockerHub('amazonlinux', 'latest'),
targetRepository: imagebuilder.Repository.fromEcr(
ecr.Repository.fromRepositoryName(this, 'Repository', 'my-container-repo')
),
dockerfile: imagebuilder.DockerfileData.fromInline(`
FROM {{{ imagebuilder:parentImage }}}
CMD ["echo", "Hello, world!"]
{{{ imagebuilder:environments }}}
{{{ imagebuilder:components }}}
`)
});
Initializer
new DockerfileData()
Methods
| Name | Description |
|---|---|
| render() | The rendered Dockerfile value, for use in CloudFormation. |
| static from | Uploads dockerfile data from a local file to S3 to use as the dockerfile data. |
| static from | Uses an inline string as the dockerfile data. |
| static from | References dockerfile data from a pre-existing S3 object. |
render()
public render(): DockerfileTemplateConfig
Returns
The rendered Dockerfile value, for use in CloudFormation.
- For inline dockerfiles, dockerfileTemplateData is the Dockerfile template text
- For S3-backed dockerfiles, dockerfileTemplateUri is the S3 URL
static fromAsset(scope, id, path, options?)
public static fromAsset(scope: Construct, id: string, path: string, options?: AssetOptions): S3DockerfileData
Parameters
- scope
Constructโ The construct scope. - id
stringโ Identifier of the construct. - path
stringโ The local path to the dockerfile data file. - options
Assetโ S3 asset upload options.Options
Returns
Uploads dockerfile data from a local file to S3 to use as the dockerfile data.
static fromInline(data)
public static fromInline(data: string): DockerfileData
Parameters
- data
stringโ An inline string representing the dockerfile data.
Returns
Uses an inline string as the dockerfile data.
static fromS3(bucket, key)
public static fromS3(bucket: IBucket, key: string): S3DockerfileData
Parameters
- bucket
IBucketโ The S3 bucket where the dockerfile data is stored. - key
stringโ The S3 key of the dockerfile data file.
Returns
References dockerfile data from a pre-existing S3 object.

.NET
Go
Java
Python
TypeScript (