Interface IDockerImageAssetSource
Namespace: Amazon.CDK
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface IDockerImageAssetSource
Syntax (vb)
Public Interface IDockerImageAssetSource
Remarks
ExampleMetadata: fixture=_generated
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
AssetName = "assetName",
DirectoryName = "directoryName",
DisplayName = "displayName",
DockerBuildArgs = new Dictionary<string, string> {
{ "dockerBuildArgsKey", "dockerBuildArgs" }
},
DockerBuildSecrets = new Dictionary<string, string> {
{ "dockerBuildSecretsKey", "dockerBuildSecrets" }
},
DockerBuildSsh = "dockerBuildSsh",
DockerBuildTarget = "dockerBuildTarget",
DockerCacheDisabled = false,
DockerCacheFrom = new [] { new DockerCacheOption {
Type = "type",
// the properties below are optional
Params = new Dictionary<string, string> {
{ "paramsKey", "params" }
}
} },
DockerCacheTo = new DockerCacheOption {
Type = "type",
// the properties below are optional
Params = new Dictionary<string, string> {
{ "paramsKey", "params" }
}
},
DockerFile = "dockerFile",
DockerOutputs = new [] { "dockerOutputs" },
Executable = new [] { "executable" },
NetworkMode = "networkMode",
Platform = "platform"
};
Synopsis
Properties
AssetName | Unique identifier of the docker image asset and its potential revisions. |
DirectoryName | The directory where the Dockerfile is stored, must be relative to the cloud assembly root. |
DisplayName | A display name for this asset. |
DockerBuildArgs | Build args to pass to the |
DockerBuildSecrets | Build secrets to pass to the |
DockerBuildSsh | SSH agent socket or keys to pass to the |
DockerBuildTarget | Docker target to build to. |
DockerCacheDisabled | Disable the cache and pass |
DockerCacheFrom | Cache from options to pass to the |
DockerCacheTo | Cache to options to pass to the |
DockerFile | Path to the Dockerfile (relative to the directory). |
DockerOutputs | Outputs to pass to the |
Executable | An external command that will produce the packaged asset. |
NetworkMode | Networking mode for the RUN commands during build. Requires Docker Engine API v1.25+. |
Platform | Platform to build for. Requires Docker Buildx. |
SourceHash | The hash of the contents of the docker build context. |
Properties
AssetName
Unique identifier of the docker image asset and its potential revisions.
string? AssetName { get; }
Property Value
Remarks
Required if using AppScopedStagingSynthesizer.
Default: - no asset name
DirectoryName
The directory where the Dockerfile is stored, must be relative to the cloud assembly root.
string? DirectoryName { get; }
Property Value
Remarks
Default: - Exactly one of directoryName
and executable
is required
DisplayName
A display name for this asset.
string? DisplayName { get; }
Property Value
Remarks
If supplied, the display name will be used in locations where the asset identifier is printed, like in the CLI progress information.
Default: - The asset hash is used to display the asset
DockerBuildArgs
Build args to pass to the docker build
command.
IDictionary<string, string>? DockerBuildArgs { get; }
Property Value
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
DockerBuildSecrets
Build secrets to pass to the docker build
command.
IDictionary<string, string>? DockerBuildSecrets { get; }
Property Value
Remarks
Since Docker build secrets 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 secrets are passed
DockerBuildSsh
SSH agent socket or keys to pass to the docker buildx
command.
string? DockerBuildSsh { get; }
Property Value
Remarks
Default: - no ssh arg is passed
DockerBuildTarget
Docker target to build to.
string? DockerBuildTarget { get; }
Property Value
Remarks
Only allowed when directoryName
is specified.
Default: - no target
DockerCacheDisabled
Disable the cache and pass --no-cache
to the docker build
command.
bool? DockerCacheDisabled { get; }
Property Value
bool?
Remarks
Default: - cache is used
DockerCacheFrom
Cache from options to pass to the docker build
command.
IDockerCacheOption[]? DockerCacheFrom { get; }
Property Value
Remarks
Default: - no cache from args are passed
DockerCacheTo
Cache to options to pass to the docker build
command.
IDockerCacheOption? DockerCacheTo { get; }
Property Value
Remarks
Default: - no cache to args are passed
DockerFile
Path to the Dockerfile (relative to the directory).
string? DockerFile { get; }
Property Value
Remarks
Only allowed when directoryName
is specified.
Default: - no file
DockerOutputs
Outputs to pass to the docker build
command.
string[]? DockerOutputs { get; }
Property Value
string[]
Remarks
Default: - no build args are passed
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
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
Remarks
Specify this property to build images on a specific platform.
Default: - no platform specified (the current machine architecture will be used)
SourceHash
The hash of the contents of the docker build context.
string SourceHash { get; }
Property Value
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).