Class DockerImageAsset
An asset that represents a Docker image.
Inheritance
Namespace: Amazon.CDK.AWS.Ecr.Assets
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class DockerImageAsset : Construct
Syntax (vb)
Public Class DockerImageAsset
Inherits Construct
Remarks
The image will be created in build time and uploaded to an ECR repository.
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.Ecr.Assets;
var asset = new DockerImageAsset(this, "MyBuildImage", new DockerImageAssetProps {
Directory = Join(__dirname, "my-image"),
BuildArgs = new Dictionary<string, string> {
{ "HTTP_PROXY", "http://10.20.30.2:1234" }
},
Invalidation = new DockerImageAssetInvalidationOptions {
BuildArgs = false
}
});
Synopsis
Constructors
DockerImageAsset(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
DockerImageAsset(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
DockerImageAsset(Construct, String, IDockerImageAssetProps) |
Properties
AssetHash | A hash of this asset, which is available at construction time. |
ImageTag | The tag of this asset when it is uploaded to ECR. |
ImageUri | The full URI of the image (including a tag). |
Repository | Repository where the image is stored. |
Methods
AddResourceMetadata(CfnResource, String) | Adds CloudFormation template metadata to the specified resource with information that indicates which resource property is mapped to this local asset. |
Constructors
DockerImageAsset(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected DockerImageAsset(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
DockerImageAsset(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected DockerImageAsset(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
DockerImageAsset(Construct, String, IDockerImageAssetProps)
public DockerImageAsset(Construct scope, string id, IDockerImageAssetProps props)
Parameters
- scope Constructs.Construct
- id System.String
- props IDockerImageAssetProps
Properties
AssetHash
A hash of this asset, which is available at construction time.
public virtual string AssetHash { get; }
Property Value
System.String
Remarks
As this is a plain string, it can be used in construct IDs in order to enforce creation of a new resource when the content hash has changed.
ImageTag
The tag of this asset when it is uploaded to ECR.
public virtual string ImageTag { get; }
Property Value
System.String
Remarks
The tag may differ from the assetHash if a stack synthesizer adds a dockerTagPrefix.
ImageUri
The full URI of the image (including a tag).
public virtual string ImageUri { get; set; }
Property Value
System.String
Remarks
Use this reference to pull the asset.
Repository
Repository where the image is stored.
public virtual IRepository Repository { get; set; }
Property Value
Methods
AddResourceMetadata(CfnResource, String)
Adds CloudFormation template metadata to the specified resource with information that indicates which resource property is mapped to this local asset.
public virtual void AddResourceMetadata(CfnResource resource, string resourceProperty)
Parameters
- resource CfnResource
The CloudFormation resource which is using this asset [disable-awslint:ref-via-interface].
- resourceProperty System.String
The property name where this asset is referenced.
Remarks
This can be used by tools such as SAM CLI to provide local experience such as local invocation and debugging of Lambda functions.
Asset metadata will only be included if the stack is synthesized with the "aws:cdk:enable-asset-metadata" context key defined, which is the default behavior when synthesizing via the CDK Toolkit.