Class DockerImageAssetProps
Props for DockerImageAssets.
Inheritance
Namespace: Amazon.CDK.AWS.Ecr.Assets
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class DockerImageAssetProps : Object, IDockerImageAssetProps, IDockerImageAssetOptions, IFileFingerprintOptions, IFileCopyOptions
Syntax (vb)
Public Class DockerImageAssetProps
Inherits Object
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
Docker |
Properties
Asset |
Unique identifier of the docker image asset and its potential revisions. |
Build |
Build args to pass to the |
Build |
Build secrets. |
Build |
SSH agent socket or keys to pass to the |
Cache |
Disable the cache and pass |
Cache |
Cache from options to pass to the |
Cache |
Cache to options to pass to the |
Directory | The directory where the Dockerfile is stored. |
Display |
A display name for this asset. |
Exclude | File paths matching the patterns will be excluded. |
Extra |
Extra information to encode into the fingerprint (e.g. build instructions and other inputs). |
File | Path to the Dockerfile (relative to the directory). |
Follow |
A strategy for how to handle symlinks. |
Ignore |
The ignore behavior to use for |
Invalidation | Options to control which parameters are used to invalidate the asset hash. |
Network |
Networking mode for the RUN commands during build. |
Outputs | Outputs to pass to the |
Platform | Platform to build for. |
Target | Docker target to build to. |
Constructors
DockerImageAssetProps()
public DockerImageAssetProps()
Properties
AssetName
Unique identifier of the docker image asset and its potential revisions.
public string AssetName { get; set; }
Property Value
System.
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
System.
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
System.
Remarks
Docker BuildKit must be enabled to use build secrets.
Default: - no build secrets
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
System.
Remarks
Docker BuildKit must be enabled to use the ssh flag
Default: - no --ssh flag
CacheDisabled
Disable the cache and pass --no-cache
to the docker build
command.
public Nullable<bool> CacheDisabled { get; set; }
Property Value
System.
Remarks
Default: - cache is used
CacheFrom
Cache from options to pass to the docker build
command.
public IDockerCacheOption[] CacheFrom { get; set; }
Property Value
Remarks
Default: - no cache from options are passed to the build command
CacheTo
Cache to options to pass to the docker build
command.
public IDockerCacheOption CacheTo { get; set; }
Property Value
Remarks
Default: - no cache to options are passed to the build command
Directory
The directory where the Dockerfile is stored.
public string Directory { get; set; }
Property Value
System.
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
System.
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
System.
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
System.
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
System.
Remarks
Default: 'Dockerfile'
FollowSymlinks
A strategy for how to handle symlinks.
public Nullable<SymlinkFollowMode> FollowSymlinks { get; set; }
Property Value
System.
Remarks
Default: SymlinkFollowMode.NEVER
IgnoreMode
The ignore behavior to use for exclude
patterns.
public Nullable<IgnoreMode> IgnoreMode { get; set; }
Property Value
System.
Remarks
Default: IgnoreMode.GLOB
Invalidation
Options to control which parameters are used to invalidate the asset hash.
public IDockerImageAssetInvalidationOptions Invalidation { get; set; }
Property Value
IDocker
Remarks
Default: - hash all parameters
NetworkMode
Networking mode for the RUN commands during build.
public NetworkMode NetworkMode { get; set; }
Property Value
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
System.
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
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
System.
Remarks
Default: - no target