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
DockerImageAssetProps() |
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 |
Directory | The directory where the Dockerfile is stored. |
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
DockerImageAssetProps()
public DockerImageAssetProps()
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
Directory
The directory where the Dockerfile is stored.
public string Directory { get; set; }
Property Value
System.String
Remarks
Any directory inside with a name that matches the CDK output folder (cdk.out by default) will be excluded from the asset
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