Skip to content

Latest commit

 

History

History
567 lines (339 loc) · 17 KB

API.md

File metadata and controls

567 lines (339 loc) · 17 KB

API Reference

Constructs

DockerImageDeployment

DockerImageDeployment pushes an image from a local or external source to a specified external destination.

Initializers

import { DockerImageDeployment } from 'cdk-docker-image-deployment'

new DockerImageDeployment(scope: Construct, id: string, props: DockerImageDeploymentProps)
Name Type Description
scope constructs.Construct No description.
id string No description.
props DockerImageDeploymentProps No description.

scopeRequired
  • Type: constructs.Construct

idRequired
  • Type: string

propsRequired

Methods

Name Description
toString Returns a string representation of this construct.

toString
public toString(): string

Returns a string representation of this construct.

Static Functions

Name Description
isConstruct Checks if x is a construct.

isConstruct
import { DockerImageDeployment } from 'cdk-docker-image-deployment'

DockerImageDeployment.isConstruct(x: any)

Checks if x is a construct.

xRequired
  • Type: any

Any object.


Properties

Name Type Description
node constructs.Node The tree node.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


Structs

DestinationConfig

Destination information.

Initializer

import { DestinationConfig } from 'cdk-docker-image-deployment'

const destinationConfig: DestinationConfig = { ... }

Properties

Name Type Description
destinationUri string The URI of the destination repository to deploy to.
loginConfig LoginConfig The login command and region.
destinationTag string The tag of the deployed image.

destinationUriRequired
public readonly destinationUri: string;
  • Type: string

The URI of the destination repository to deploy to.


loginConfigRequired
public readonly loginConfig: LoginConfig;

The login command and region.


destinationTagOptional
public readonly destinationTag: string;
  • Type: string
  • Default: the tag of the source

The tag of the deployed image.


DockerImageDeploymentProps

Initializer

import { DockerImageDeploymentProps } from 'cdk-docker-image-deployment'

const dockerImageDeploymentProps: DockerImageDeploymentProps = { ... }

Properties

Name Type Description
destination Destination Destination repository to deploy the image to.
source Source Source of the image to deploy.

destinationRequired
public readonly destination: Destination;

Destination repository to deploy the image to.


sourceRequired
public readonly source: Source;

Source of the image to deploy.


EcrSourceOptions

Properties needed for Source.ecr.

Initializer

import { EcrSourceOptions } from 'cdk-docker-image-deployment'

const ecrSourceOptions: EcrSourceOptions = { ... }

Properties

Name Type Description
tag string Tag of deployed image.

tagOptional
public readonly tag: string;
  • Type: string
  • Default: tag of source

Tag of deployed image.


LoginConfig

Login commands for specified registry.

Initializer

import { LoginConfig } from 'cdk-docker-image-deployment'

const loginConfig: LoginConfig = { ... }

Properties

Name Type Description
loginCommand string Command to run in codebuild to login.
region string Region of ECR repository.

loginCommandRequired
public readonly loginCommand: string;
  • Type: string

Command to run in codebuild to login.

Formatted docker login ....


regionOptional
public readonly region: string;
  • Type: string
  • Default: undefined if not an ECR repository

Region of ECR repository.


SourceConfig

Source information.

Initializer

import { SourceConfig } from 'cdk-docker-image-deployment'

const sourceConfig: SourceConfig = { ... }

Properties

Name Type Description
imageTag string The source tag.
imageUri string The source image URI.
loginConfig LoginConfig The login command and region.

imageTagRequired
public readonly imageTag: string;
  • Type: string

The source tag.


imageUriRequired
public readonly imageUri: string;
  • Type: string

The source image URI.


loginConfigRequired
public readonly loginConfig: LoginConfig;

The login command and region.


SourceContext

Bind context for Source.

Initializer

import { SourceContext } from 'cdk-docker-image-deployment'

const sourceContext: SourceContext = { ... }

Properties

Name Type Description
handlerRole aws-cdk-lib.aws_iam.IRole The role for the handler.

handlerRoleRequired
public readonly handlerRole: IRole;
  • Type: aws-cdk-lib.aws_iam.IRole

The role for the handler.


Classes

Destination

Specifies docker image deployment destination.

Usage:

declare const repo: ecr.IRepository;
const destinationEcr = dockerDeploy.Destination.ecr(repository, {
   tag: 'tag',
});

Initializers

import { Destination } from 'cdk-docker-image-deployment'

new Destination()
Name Type Description

Methods

Name Description
bind Bind grants the CodeBuild role permissions to pull and push to a repository if necessary.

bind
public bind(role: IGrantable): DestinationConfig

Bind grants the CodeBuild role permissions to pull and push to a repository if necessary.

Bind should be invoked by the caller to get the DestinationConfig.

roleRequired
  • Type: aws-cdk-lib.aws_iam.IGrantable

Static Functions

Name Description
ecr Uses an ECR repository in the same account as the stack as the destination for the image.

ecr
import { Destination } from 'cdk-docker-image-deployment'

Destination.ecr(repository: IRepository, options?: EcrSourceOptions)

Uses an ECR repository in the same account as the stack as the destination for the image.

repositoryRequired
  • Type: aws-cdk-lib.aws_ecr.IRepository

optionsOptional

Source

Specifies docker image deployment source.

Usage:

import * as path from 'path';
const path = path.join(__dirname, 'path/to/directory');
const sourceDirectory = Source.directory(path);

or with additional assetOptions

import * as path from 'path';
const path = path.join(__dirname, 'path/to/directory');
const sourceDirectory = Source.directory(path, {
   file: 'Dockerfile.api',
   buildArgs: {
     HTTP_PROXY: 'http://10.20.30.2:1234'
   }
})

Initializers

import { Source } from 'cdk-docker-image-deployment'

new Source()
Name Type Description

Methods

Name Description
bind Bind grants the CodeBuild role permissions to pull from a repository if necessary.

bind
public bind(scope: Construct, context: SourceContext): SourceConfig

Bind grants the CodeBuild role permissions to pull from a repository if necessary.

Bind should be invoked by the caller to get the SourceConfig.

scopeRequired
  • Type: constructs.Construct

contextRequired

Static Functions

Name Description
directory Uses a local image built from a Dockerfile in a local directory as the source.

directory
import { Source } from 'cdk-docker-image-deployment'

Source.directory(path: string, assetOptions?: DockerImageAssetOptions)

Uses a local image built from a Dockerfile in a local directory as the source.

pathRequired
  • Type: string

path to the directory containing your Dockerfile (not a path to a file).


assetOptionsOptional
  • Type: aws-cdk-lib.aws_ecr_assets.DockerImageAssetOptions

specify any additional DockerImageAssetOptions (except path).