Show / Hide Table of Contents

Class DockerImageAssetProps

Props for DockerImageAssets.

Inheritance
object
DockerImageAssetProps
Implements
IDockerImageAssetProps
IDockerImageAssetOptions
IFileFingerprintOptions
IFileCopyOptions
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: Amazon.CDK.AWS.Ecr.Assets
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class DockerImageAssetProps : IDockerImageAssetProps, IDockerImageAssetOptions, IFileFingerprintOptions, IFileCopyOptions
Syntax (vb)
Public Class DockerImageAssetProps Implements IDockerImageAssetProps, IDockerImageAssetOptions, IFileFingerprintOptions, IFileCopyOptions
Remarks

ExampleMetadata: infused

Examples
using Amazon.CDK.AWS.Ecr.Assets;


            var asset = new DockerImageAsset(this, "MyBuildImage", new DockerImageAssetProps {
                Directory = Join(__dirname, "my-image"),
                BuildArgs = new Dictionary<string, string> {
                    { "HTTP_PROXY", "http://10.20.30.2:1234" }
                },
                Invalidation = new DockerImageAssetInvalidationOptions {
                    BuildArgs = false
                }
            });

Synopsis

Constructors

DockerImageAssetProps()

Props for DockerImageAssets.

Properties

AssetName

Unique identifier of the docker image asset and its potential revisions.

BuildArgs

Build args to pass to the docker build command.

BuildSecrets

Build secrets.

BuildSsh

SSH agent socket or keys to pass to the docker build command.

CacheDisabled

Disable the cache and pass --no-cache to the docker build command.

CacheFrom

Cache from options to pass to the docker build command.

CacheTo

Cache to options to pass to the docker build command.

Directory

The directory where the Dockerfile is stored.

DisplayName

A display name for this asset.

Exclude

File paths matching the patterns will be excluded.

ExtraHash

Extra information to encode into the fingerprint (e.g. build instructions and other inputs).

File

Path to the Dockerfile (relative to the directory).

FollowSymlinks

A strategy for how to handle symlinks.

IgnoreMode

The ignore behavior to use for exclude patterns.

Invalidation

Options to control which parameters are used to invalidate the asset hash.

NetworkMode

Networking mode for the RUN commands during build.

Outputs

Outputs to pass to the docker build command.

Platform

Platform to build for.

Target

Docker target to build to.

Constructors

DockerImageAssetProps()

Props for DockerImageAssets.

public DockerImageAssetProps()
Remarks

ExampleMetadata: infused

Examples
using Amazon.CDK.AWS.Ecr.Assets;


            var asset = new DockerImageAsset(this, "MyBuildImage", new DockerImageAssetProps {
                Directory = Join(__dirname, "my-image"),
                BuildArgs = new Dictionary<string, string> {
                    { "HTTP_PROXY", "http://10.20.30.2:1234" }
                },
                Invalidation = new DockerImageAssetInvalidationOptions {
                    BuildArgs = false
                }
            });

Properties

AssetName

Unique identifier of the docker image asset and its potential revisions.

public string? AssetName { get; set; }
Property Value

string

Remarks

Required if using AppScopedStagingSynthesizer.

Default: - no asset name

BuildArgs

Build args to pass to the docker build command.

public IDictionary<string, string>? BuildArgs { get; set; }
Property Value

IDictionary<string, string>

Remarks

Since Docker build arguments are resolved before deployment, keys and values cannot refer to unresolved tokens (such as lambda.functionArn or queue.queueUrl).

Default: - no build args are passed

BuildSecrets

Build secrets.

public IDictionary<string, string>? BuildSecrets { get; set; }
Property Value

IDictionary<string, string>

Remarks

Docker BuildKit must be enabled to use build secrets.

Default: - no build secrets

See: https://docs.docker.com/build/buildkit/

Examples
using Amazon.CDK;

             IDictionary<string, string> buildSecrets = new Dictionary<string, string> {
                 { "MY_SECRET", DockerBuildSecret.FromSrc("file.txt") }
             };

BuildSsh

SSH agent socket or keys to pass to the docker build command.

public string? BuildSsh { get; set; }
Property Value

string

Remarks

Docker BuildKit must be enabled to use the ssh flag

Default: - no --ssh flag

See: https://docs.docker.com/build/buildkit/

CacheDisabled

Disable the cache and pass --no-cache to the docker build command.

public bool? CacheDisabled { get; set; }
Property Value

bool?

Remarks

Default: - cache is used

CacheFrom

Cache from options to pass to the docker build command.

public IDockerCacheOption[]? CacheFrom { get; set; }
Property Value

IDockerCacheOption[]

Remarks

Default: - no cache from options are passed to the build command

See: https://docs.docker.com/build/cache/backends/

CacheTo

Cache to options to pass to the docker build command.

public IDockerCacheOption? CacheTo { get; set; }
Property Value

IDockerCacheOption

Remarks

Default: - no cache to options are passed to the build command

See: https://docs.docker.com/build/cache/backends/

Directory

The directory where the Dockerfile is stored.

public string Directory { get; set; }
Property Value

string

Remarks

Any directory inside with a name that matches the CDK output folder (cdk.out by default) will be excluded from the asset

DisplayName

A display name for this asset.

public string? DisplayName { get; set; }
Property Value

string

Remarks

If supplied, the display name will be used in locations where the asset identifier is printed, like in the CLI progress information. If the same asset is added multiple times, the display name of the first occurrence is used.

If assetName is given, it will also be used as the default displayName. Otherwise, the default is the construct path of the ImageAsset construct, with respect to the enclosing stack. If the asset is produced by a construct helper function (such as lambda.Code.fromAssetImage()), this will look like MyFunction/AssetImage.

We use the stack-relative construct path so that in the common case where you have multiple stacks with the same asset, we won't show something like /MyBetaStack/MyFunction/Code when you are actually deploying to production.

Default: - Stack-relative construct path

Exclude

File paths matching the patterns will be excluded.

public string[]? Exclude { get; set; }
Property Value

string[]

Remarks

See ignoreMode to set the matching behavior. Has no effect on Assets bundled using the bundling property.

Default: - nothing is excluded

ExtraHash

Extra information to encode into the fingerprint (e.g. build instructions and other inputs).

public string? ExtraHash { get; set; }
Property Value

string

Remarks

Default: - hash is only based on source content

File

Path to the Dockerfile (relative to the directory).

public string? File { get; set; }
Property Value

string

Remarks

Default: 'Dockerfile'

FollowSymlinks

A strategy for how to handle symlinks.

public SymlinkFollowMode? FollowSymlinks { get; set; }
Property Value

SymlinkFollowMode?

Remarks

Default: SymlinkFollowMode.NEVER

IgnoreMode

The ignore behavior to use for exclude patterns.

public IgnoreMode? IgnoreMode { get; set; }
Property Value

IgnoreMode?

Remarks

Default: IgnoreMode.GLOB

Invalidation

Options to control which parameters are used to invalidate the asset hash.

public IDockerImageAssetInvalidationOptions? Invalidation { get; set; }
Property Value

IDockerImageAssetInvalidationOptions

Remarks

Default: - hash all parameters

NetworkMode

Networking mode for the RUN commands during build.

public NetworkMode? NetworkMode { get; set; }
Property Value

NetworkMode

Remarks

Support docker API 1.25+.

Default: - no networking mode specified (the default networking mode NetworkMode.DEFAULT will be used)

Outputs

Outputs to pass to the docker build command.

public string[]? Outputs { get; set; }
Property Value

string[]

Remarks

Default: - no outputs are passed to the build command (default outputs are used)

See: https://docs.docker.com/engine/reference/commandline/build/#custom-build-outputs

Platform

Platform to build for.

public Platform_? Platform { get; set; }
Property Value

Platform_

Remarks

Requires Docker Buildx.

Default: - no platform specified (the current machine architecture will be used)

Target

Docker target to build to.

public string? Target { get; set; }
Property Value

string

Remarks

Default: - no target

Implements

IDockerImageAssetProps
IDockerImageAssetOptions
IFileFingerprintOptions
IFileCopyOptions
Back to top Generated by DocFX