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",
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. |
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.
virtual string AssetName { get; }
Property Value
System.String
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.
virtual string DirectoryName { get; }
Property Value
System.String
Remarks
Default: - Exactly one of directoryName
and executable
is required
DockerBuildArgs
Build args to pass to the docker build
command.
virtual IDictionary<string, string> DockerBuildArgs { get; }
Property Value
System.Collections.Generic.IDictionary<System.String, System.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
DockerBuildSecrets
Build secrets to pass to the docker build
command.
virtual IDictionary<string, string> DockerBuildSecrets { get; }
Property Value
System.Collections.Generic.IDictionary<System.String, System.String>
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.
virtual string DockerBuildSsh { get; }
Property Value
System.String
Remarks
Default: - no ssh arg is passed
DockerBuildTarget
Docker target to build to.
virtual string DockerBuildTarget { get; }
Property Value
System.String
Remarks
Only allowed when directoryName
is specified.
Default: - no target
DockerCacheDisabled
Disable the cache and pass --no-cache
to the docker build
command.
virtual Nullable<bool> DockerCacheDisabled { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: - cache is used
DockerCacheFrom
Cache from options to pass to the docker build
command.
virtual IDockerCacheOption[] DockerCacheFrom { get; }
Property Value
Remarks
Default: - no cache from args are passed
DockerCacheTo
Cache to options to pass to the docker build
command.
virtual IDockerCacheOption DockerCacheTo { get; }
Property Value
Remarks
Default: - no cache to args are passed
DockerFile
Path to the Dockerfile (relative to the directory).
virtual string DockerFile { get; }
Property Value
System.String
Remarks
Only allowed when directoryName
is specified.
Default: - no file
DockerOutputs
Outputs to pass to the docker build
command.
virtual string[] DockerOutputs { get; }
Property Value
System.String[]
Remarks
Default: - no build args are passed
Executable
An external command that will produce the packaged asset.
virtual string[] Executable { get; }
Property Value
System.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+.
virtual string NetworkMode { get; }
Property Value
System.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.
virtual string Platform { get; }
Property Value
System.String
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
System.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).