UNPKG

2.6 kBTypeScriptView Raw
1import * as ecr from '@aws-cdk/aws-ecr';
2import { DockerImageAsset } from '@aws-cdk/aws-ecr-assets';
3import { ContainerDefinition } from './container-definition';
4import { CfnTaskDefinition } from './ecs.generated';
5import { Construct as CoreConstruct } from '@aws-cdk/core';
6/**
7 * Constructs for types of container images
8 */
9export declare abstract class ContainerImage {
10 /**
11 * Reference an image on DockerHub or another online registry
12 */
13 static fromRegistry(name: string, props?: RepositoryImageProps): RepositoryImage;
14 /**
15 * Reference an image in an ECR repository
16 */
17 static fromEcrRepository(repository: ecr.IRepository, tag?: string): EcrImage;
18 /**
19 * Reference an image that's constructed directly from sources on disk.
20 *
21 * If you already have a `DockerImageAsset` instance, you can use the
22 * `ContainerImage.fromDockerImageAsset` method instead.
23 *
24 * @param directory The directory containing the Dockerfile
25 */
26 static fromAsset(directory: string, props?: AssetImageProps): AssetImage;
27 /**
28 * Use an existing `DockerImageAsset` for this container image.
29 *
30 * @param asset The `DockerImageAsset` to use for this container definition.
31 */
32 static fromDockerImageAsset(asset: DockerImageAsset): ContainerImage;
33 /**
34 * Use an existing tarball for this container image.
35 *
36 * Use this method if the container image has already been created by another process (e.g. jib)
37 * and you want to add it as a container image asset.
38 *
39 * @param tarballFile Absolute path to the tarball. You can use language-specific idioms (such as `__dirname` in Node.js)
40 * to create an absolute path based on the current script running directory.
41 */
42 static fromTarball(tarballFile: string): ContainerImage;
43 /**
44 * Called when the image is used by a ContainerDefinition
45 */
46 abstract bind(scope: CoreConstruct, containerDefinition: ContainerDefinition): ContainerImageConfig;
47}
48/**
49 * The configuration for creating a container image.
50 */
51export interface ContainerImageConfig {
52 /**
53 * Specifies the name of the container image.
54 */
55 readonly imageName: string;
56 /**
57 * Specifies the credentials used to access the image repository.
58 */
59 readonly repositoryCredentials?: CfnTaskDefinition.RepositoryCredentialsProperty;
60}
61import { AssetImage, AssetImageProps } from './images/asset-image';
62import { EcrImage } from './images/ecr';
63import { RepositoryImage, RepositoryImageProps } from './images/repository';