deploy-time-build
Version:
Build during CDK deployment.
85 lines (84 loc) • 3.36 kB
TypeScript
import { IVpc } from 'aws-cdk-lib/aws-ec2';
import { IRepository } from 'aws-cdk-lib/aws-ecr';
import { DockerImageAssetProps } from 'aws-cdk-lib/aws-ecr-assets';
import { IGrantable, IPrincipal } from 'aws-cdk-lib/aws-iam';
import { DockerImageCode } from 'aws-cdk-lib/aws-lambda';
import { Construct } from 'constructs';
export interface ContainerImageBuildProps extends DockerImageAssetProps {
/**
* The tag when to push the image
* @default use assetHash as tag
*/
readonly tag?: string;
/**
* Prefix to add to the image tag
* @default no prefix
*/
readonly tagPrefix?: string;
/**
* The ECR repository to push the image.
* @default create a new ECR repository
*/
readonly repository?: IRepository;
/**
* Use zstd for compressing a container image.
* @default false
*/
readonly zstdCompression?: boolean;
/**
* The VPC where your build job will be deployed.
* This VPC must have private subnets with NAT Gateways.
*
* Use this property when you want to control the outbound IP addresses that base images are pulled from.
* @default No VPC used.
*/
readonly vpc?: IVpc;
}
/**
* Options for configuring Lambda Docker image code.
*/
export interface LambdaDockerImageOptions {
/**
* Specify or override the CMD on the specified Docker image or Dockerfile.
* This needs to be in the 'exec form', viz., `[ 'executable', 'param1', 'param2' ]`.
* @see <https://docs.docker.com/engine/reference/builder/#cmd>
* @default - use the CMD specified in the docker image or Dockerfile.
*/
readonly cmd?: string[];
/**
* Specify or override the ENTRYPOINT on the specified Docker image or Dockerfile.
* An ENTRYPOINT allows you to configure a container that will run as an executable.
* This needs to be in the 'exec form', viz., `[ 'executable', 'param1', 'param2' ]`.
* @see <https://docs.docker.com/engine/reference/builder/#entrypoint>
* @default - use the ENTRYPOINT in the docker image or Dockerfile.
*/
readonly entrypoint?: string[];
/**
* Specify or override the WORKDIR on the specified Docker image or Dockerfile.
* A WORKDIR allows you to configure the working directory the container will use.
* @see <https://docs.docker.com/engine/reference/builder/#workdir>
* @default - use the WORKDIR in the docker image or Dockerfile.
*/
readonly workingDirectory?: string;
}
/**
* Build a container image and push it to an ECR repository on deploy-time.
*/
export declare class ContainerImageBuild extends Construct implements IGrantable {
private readonly props;
readonly grantPrincipal: IPrincipal;
readonly repository: IRepository;
readonly imageTag: string;
readonly imageUri: string;
constructor(scope: Construct, id: string, props: ContainerImageBuildProps);
/**
* Get the instance of {@link DockerImageCode} for a Lambda function image.
* @param options Optional configuration for Docker image code.
*/
toLambdaDockerImageCode(options?: LambdaDockerImageOptions): DockerImageCode;
/**
* Get the instance of {@link ContainerImage} for an ECS task definition.
*/
toEcsDockerImageCode(): import("aws-cdk-lib/aws-ecs").EcrImage;
private getDockerBuildCommand;
}