class AssetImage
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.ECS.AssetImage |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsecs#AssetImage |
Java | software.amazon.awscdk.services.ecs.AssetImage |
Python | aws_cdk.aws_ecs.AssetImage |
TypeScript (source) | aws-cdk-lib » aws_ecs » AssetImage |
Extends
Container
An image that will be built from a local directory with a Dockerfile.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_ecr_assets as ecr_assets } from 'aws-cdk-lib';
import { aws_ecs as ecs } from 'aws-cdk-lib';
declare const networkMode: ecr_assets.NetworkMode;
declare const platform: ecr_assets.Platform;
const assetImage = ecs.AssetImage.fromAsset('directory', /* all optional props */ {
assetName: 'assetName',
buildArgs: {
buildArgsKey: 'buildArgs',
},
buildSecrets: {
buildSecretsKey: 'buildSecrets',
},
buildSsh: 'buildSsh',
cacheDisabled: false,
cacheFrom: [{
type: 'type',
// the properties below are optional
params: {
paramsKey: 'params',
},
}],
cacheTo: {
type: 'type',
// the properties below are optional
params: {
paramsKey: 'params',
},
},
exclude: ['exclude'],
extraHash: 'extraHash',
file: 'file',
followSymlinks: cdk.SymlinkFollowMode.NEVER,
ignoreMode: cdk.IgnoreMode.GLOB,
invalidation: {
buildArgs: false,
buildSecrets: false,
buildSsh: false,
extraHash: false,
file: false,
networkMode: false,
outputs: false,
platform: false,
repositoryName: false,
target: false,
},
networkMode: networkMode,
outputs: ['outputs'],
platform: platform,
target: 'target',
});
Initializer
new AssetImage(directory: string, props?: AssetImageProps)
Parameters
- directory
string
— The directory containing the Dockerfile. - props
Asset
Image Props
Constructs a new instance of the AssetImage class.
Methods
Name | Description |
---|---|
bind(scope, containerDefinition) | Called when the image is used by a ContainerDefinition. |
bind(scope, containerDefinition)
public bind(scope: Construct, containerDefinition: ContainerDefinition): ContainerImageConfig
Parameters
- scope
Construct
- containerDefinition
Container
Definition
Returns
Called when the image is used by a ContainerDefinition.