Interface IDockerImageAssetOptions
Options for DockerImageAsset.
Inherited Members
Namespace: Amazon.CDK.AWS.Ecr.Assets
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface IDockerImageAssetOptions : IFileFingerprintOptions, IFileCopyOptions
Syntax (vb)
Public Interface IDockerImageAssetOptions
Inherits 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;
NetworkMode networkMode;
Platform platform;
var dockerImageAssetOptions = new DockerImageAssetOptions {
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
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 |
File | Path to the Dockerfile (relative to the directory). |
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. |
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
BuildArgs
Build args to pass to the docker build
command.
virtual IDictionary<string, string> BuildArgs { 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
).
Default: - no build args are passed
BuildSecrets
Build secrets.
virtual IDictionary<string, string> BuildSecrets { get; }
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.
virtual string BuildSsh { get; }
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.
virtual Nullable<bool> CacheDisabled { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: - cache is used
CacheFrom
Cache from options to pass to the docker build
command.
virtual IDockerCacheOption[] CacheFrom { get; }
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.
virtual IDockerCacheOption CacheTo { get; }
Property Value
Remarks
Default: - no cache to options are passed to the build command
File
Path to the Dockerfile (relative to the directory).
virtual string File { get; }
Property Value
System.String
Remarks
Default: 'Dockerfile'
Invalidation
Options to control which parameters are used to invalidate the asset hash.
virtual IDockerImageAssetInvalidationOptions Invalidation { get; }
Property Value
IDockerImageAssetInvalidationOptions
Remarks
Default: - hash all parameters
NetworkMode
Networking mode for the RUN commands during build.
virtual NetworkMode NetworkMode { get; }
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.
virtual string[] Outputs { get; }
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.
virtual Platform_ Platform { get; }
Property Value
Remarks
Requires Docker Buildx.
Default: - no platform specified (the current machine architecture will be used)
Target
Docker target to build to.
virtual string Target { get; }
Property Value
System.String
Remarks
Default: - no target