DockerfileData Class
Helper class for referencing and uploading dockerfile data for the container recipe.
Example
ts
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
ts
new DockerfileData()
python
DockerfileData()
java
new DockerfileData()
csharp
new DockerfileData()
go
NewDockerfileData()
Methods
fromAsset(scope: Construct, id: string, path: string, options?: AssetOptions): S3DockerfileData@staticmethod def from_asset(scope: Construct, id: str, path: str, options: typing.Optional[AssetOptions] = None) -> S3DockerfileDatapublic static S3DockerfileData fromAsset(Construct scope, String id, String path, AssetOptions options)public static S3DockerfileData FromAsset(Construct scope, string id, string path, AssetOptions? options = null)func FromAsset(Scope Construct, Id *string, Path *string, Options AssetOptions) S3DockerfileDatastatic#Uploads dockerfile data from a local file to S3 to use as the dockerfile data.
4 parameters
Parameters
scopescopescopescopeScope— The construct scope.ididididId— Identifier of the construct.pathpathpathpathPath— The local path to the dockerfile data file.optionsoptionsoptionsoptionsOptions— S3 asset upload options.
fromInline(data: string): DockerfileData // chainable@staticmethod def from_inline(data: str) -> DockerfileDatapublic static DockerfileData fromInline(String data)public static DockerfileData FromInline(string data)func FromInline(Data *string) DockerfileDatastatic#Uses an inline string as the dockerfile data.
1 parameter
Parameters
datadatadatadataData— An inline string representing the dockerfile data.
fromS3(bucket: IBucket, key: string): S3DockerfileData@staticmethod def from_s3(bucket: IBucket, key: str) -> S3DockerfileDatapublic static S3DockerfileData fromS3(IBucket bucket, String key)public static S3DockerfileData FromS3(IBucket bucket, string key)func FromS3(Bucket IBucket, Key *string) S3DockerfileDatastatic#References dockerfile data from a pre-existing S3 object.
2 parameters
Parameters
bucketbucketbucketbucketBucket— The S3 bucket where the dockerfile data is stored.keykeykeykeyKey— The S3 key of the dockerfile data file.
render(): DockerfileTemplateConfigdef render(self, ) -> DockerfileTemplateConfigpublic DockerfileTemplateConfig render()public DockerfileTemplateConfig Render()func Render() DockerfileTemplateConfig#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