Table of Contents

Interface IDockerImageAssetSource

Namespace
Amazon.CDK
Assembly
Amazon.CDK.dll
public interface IDockerImageAssetSource

Examples

// The code below shows an example of how to instantiate this type.
            // The values are placeholders you should change.
            using Amazon.CDK;
            var dockerImageAssetSource = new DockerImageAssetSource {
                SourceHash = "sourceHash",

                // the properties below are optional
                DirectoryName = "directoryName",
                DockerBuildArgs = new Dictionary<string, string> {
                    { "dockerBuildArgsKey", "dockerBuildArgs" }
                },
                DockerBuildTarget = "dockerBuildTarget",
                DockerFile = "dockerFile",
                Executable = new [] { "executable" },
                NetworkMode = "networkMode",
                Platform = "platform",
                RepositoryName = "repositoryName"
            };

Remarks

ExampleMetadata: fixture=_generated

Properties

DirectoryName

The directory where the Dockerfile is stored, must be relative to the cloud assembly root.

string? DirectoryName { get; }

Property Value

string

Remarks

Default: - Exactly one of directoryName and executable is required

DockerBuildArgs

Build args to pass to the docker build command.

IDictionary<string, string>? DockerBuildArgs { get; }

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).

Only allowed when directoryName is specified.

Default: - no build args are passed

DockerBuildTarget

Docker target to build to.

string? DockerBuildTarget { get; }

Property Value

string

Remarks

Only allowed when directoryName is specified.

Default: - no target

DockerFile

Path to the Dockerfile (relative to the directory).

string? DockerFile { get; }

Property Value

string

Remarks

Only allowed when directoryName is specified.

Default: - no file

Executable

An external command that will produce the packaged asset.

string[]? Executable { get; }

Property Value

string[]

Remarks

The command should produce the name of a local Docker image on stdout.

Default: - Exactly one of directoryName and executable is required

NetworkMode

Networking mode for the RUN commands during build. Requires Docker Engine API v1.25+.

string? NetworkMode { get; }

Property Value

string

Remarks

Specify this property to build images on a specific networking mode.

Default: - no networking mode specified

Platform

Platform to build for. Requires Docker Buildx.

string? Platform { get; }

Property Value

string

Remarks

Specify this property to build images on a specific platform.

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

RepositoryName

(deprecated) ECR repository name.

[Obsolete("repository name should be specified at the environment-level and not at the image level")]
string? RepositoryName { get; }

Property Value

string

Remarks

Specify this property if you need to statically address the image, e.g. from a Kubernetes Pod. Note, this is only the repository name, without the registry and the tag parts.

Default: - automatically derived from the asset's ID.

Stability: Deprecated

SourceHash

The hash of the contents of the docker build context.

string SourceHash { get; }

Property Value

string

Remarks

This hash is used throughout the system to identify this image and avoid duplicate work in case the source did not change.

NOTE: this means that if you wish to update your docker image, you must make a modification to the source (e.g. add some metadata to your Dockerfile).