Class AssetImageProps
The properties for building an AssetImage.
Inheritance
Namespace: Amazon.CDK.AWS.ECS
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class AssetImageProps : Object, IAssetImageProps, IDockerImageAssetOptions, IFileFingerprintOptions, IFileCopyOptions
Syntax (vb)
Public Class AssetImageProps
Inherits Object
Implements IAssetImageProps, IDockerImageAssetOptions, IFileFingerprintOptions, IFileCopyOptions
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;
using Amazon.CDK.AWS.Ecr.Assets;
using Amazon.CDK.AWS.ECS;
NetworkMode networkMode;
Platform platform;
var assetImageProps = new AssetImageProps {
AssetName = "assetName",
BuildArgs = new Dictionary<string, string> {
{ "buildArgsKey", "buildArgs" }
},
BuildSecrets = new Dictionary<string, string> {
{ "buildSecretsKey", "buildSecrets" }
},
BuildSsh = "buildSsh",
CacheDisabled = false,
CacheFrom = new [] { new DockerCacheOption {
Type = "type",
// the properties below are optional
Params = new Dictionary<string, string> {
{ "paramsKey", "params" }
}
} },
CacheTo = new DockerCacheOption {
Type = "type",
// the properties below are optional
Params = new Dictionary<string, string> {
{ "paramsKey", "params" }
}
},
Exclude = new [] { "exclude" },
ExtraHash = "extraHash",
File = "file",
FollowSymlinks = SymlinkFollowMode.NEVER,
IgnoreMode = IgnoreMode.GLOB,
Invalidation = new DockerImageAssetInvalidationOptions {
BuildArgs = false,
BuildSecrets = false,
BuildSsh = false,
ExtraHash = false,
File = false,
NetworkMode = false,
Outputs = false,
Platform = false,
RepositoryName = false,
Target = false
},
NetworkMode = networkMode,
Outputs = new [] { "outputs" },
Platform = platform,
Target = "target"
};
Synopsis
Constructors
AssetImageProps() |
Properties
AssetName | Unique identifier of the docker image asset and its potential revisions. |
BuildArgs | Build args to pass to the |
BuildSecrets | Build secrets. |
BuildSsh | SSH agent socket or keys to pass to the |
CacheDisabled | Disable the cache and pass |
CacheFrom | Cache from options to pass to the |
CacheTo | Cache to options to pass to the |
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 |
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 |
Platform | Platform to build for. |
Target | Docker target to build to. |
Constructors
AssetImageProps()
public AssetImageProps()
Properties
AssetName
Unique identifier of the docker image asset and its potential revisions.
public string AssetName { get; set; }
Property Value
System.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
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
).
Default: - no build args are passed
BuildSecrets
Build secrets.
public IDictionary<string, string> BuildSecrets { get; set; }
Property Value
System.Collections.Generic.IDictionary<System.String, System.String>
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.String
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.Nullable<System.Boolean>
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
Exclude
File paths matching the patterns will be excluded.
public string[] Exclude { get; set; }
Property Value
System.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
System.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
System.String
Remarks
Default: 'Dockerfile'
FollowSymlinks
A strategy for how to handle symlinks.
public Nullable<SymlinkFollowMode> FollowSymlinks { get; set; }
Property Value
System.Nullable<SymlinkFollowMode>
Remarks
Default: SymlinkFollowMode.NEVER
IgnoreMode
The ignore behavior to use for exclude
patterns.
public Nullable<IgnoreMode> IgnoreMode { get; set; }
Property Value
System.Nullable<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
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.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
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.String
Remarks
Default: - no target