class AssetImage
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.ECS.AssetImage |
![]() | software.amazon.awscdk.services.ecs.AssetImage |
![]() | aws_cdk.aws_ecs.AssetImage |
![]() | @aws-cdk/aws-ecs » AssetImage |
Extends
Container
An image that will be built from a local directory with a Dockerfile.
Example
import { App, Stack } from '@aws-cdk/core';
import * as ec2 from '@aws-cdk/aws-ec2';
import * as ecs from '@aws-cdk/aws-ecs';
import * as ecsPatterns from '@aws-cdk/aws-ecs-patterns';
import * as cxapi from '@aws-cdk/cx-api';
import * as path from 'path';
const app = new App();
const stack = new Stack(app, 'aws-ecs-patterns-queue');
stack.node.setContext(cxapi.ECS_REMOVE_DEFAULT_DESIRED_COUNT, true);
const vpc = new ec2.Vpc(stack, 'VPC', {
maxAzs: 2,
});
new ecsPatterns.QueueProcessingFargateService(stack, 'QueueProcessingService', {
vpc,
memoryLimitMiB: 512,
image: new ecs.AssetImage(path.join(__dirname, '..', 'sqs-reader')),
});
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.