Class DockerImageSource
Properties for how to produce a Docker image from a source.
Inheritance
Implements
Namespace: Amazon.CDK.CloudAssembly.Schema
Assembly: Amazon.CDK.CloudAssembly.Schema.dll
Syntax (csharp)
public class DockerImageSource : Object, IDockerImageSource
Syntax (vb)
Public Class DockerImageSource
Inherits Object
Implements IDockerImageSource
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.CloudAssembly.Schema;
var dockerImageSource = new DockerImageSource {
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" }
}
},
Directory = "directory",
DockerBuildArgs = new Dictionary<string, string> {
{ "dockerBuildArgsKey", "dockerBuildArgs" }
},
DockerBuildSecrets = new Dictionary<string, string> {
{ "dockerBuildSecretsKey", "dockerBuildSecrets" }
},
DockerBuildSsh = "dockerBuildSsh",
DockerBuildTarget = "dockerBuildTarget",
DockerFile = "dockerFile",
DockerOutputs = new [] { "dockerOutputs" },
Executable = new [] { "executable" },
NetworkMode = "networkMode",
Platform = "platform"
};
Synopsis
Constructors
DockerImageSource() |
Properties
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 containing the Docker image build instructions. |
DockerBuildArgs | Additional build arguments. |
DockerBuildSecrets | Additional build secrets. |
DockerBuildSsh | SSH agent socket or keys. |
DockerBuildTarget | Target build stage in a Dockerfile with multiple build stages. |
DockerFile | The name of the file with build instructions. |
DockerOutputs | Outputs. |
Executable | A command-line executable that returns the name of a local Docker image on stdout after being run. |
NetworkMode | Networking mode for the RUN commands during build. Requires Docker Engine API v1.25+. |
Platform | Platform to build for. Requires Docker Buildx. |
Constructors
DockerImageSource()
public DockerImageSource()
Properties
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 containing the Docker image build instructions.
public string Directory { get; set; }
Property Value
System.String
Remarks
This path is relative to the asset manifest location.
Default: - Exactly one of directory
and executable
is required
DockerBuildArgs
Additional build arguments.
public IDictionary<string, string> DockerBuildArgs { get; set; }
Property Value
System.Collections.Generic.IDictionary<System.String, System.String>
Remarks
Only allowed when directory
is set.
Default: - No additional build arguments
DockerBuildSecrets
Additional build secrets.
public IDictionary<string, string> DockerBuildSecrets { get; set; }
Property Value
System.Collections.Generic.IDictionary<System.String, System.String>
Remarks
Only allowed when directory
is set.
Default: - No additional build secrets
DockerBuildSsh
SSH agent socket or keys.
public string DockerBuildSsh { get; set; }
Property Value
System.String
Remarks
Requires building with docker buildkit.
Default: - No ssh flag is set
DockerBuildTarget
Target build stage in a Dockerfile with multiple build stages.
public string DockerBuildTarget { get; set; }
Property Value
System.String
Remarks
Only allowed when directory
is set.
Default: - The last stage in the Dockerfile
DockerFile
The name of the file with build instructions.
public string DockerFile { get; set; }
Property Value
System.String
Remarks
Only allowed when directory
is set.
Default: "Dockerfile"
DockerOutputs
Outputs.
public string[] DockerOutputs { 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
Executable
A command-line executable that returns the name of a local Docker image on stdout after being run.
public string[] Executable { get; set; }
Property Value
System.String[]
Remarks
Default: - Exactly one of directory
and executable
is required
NetworkMode
Networking mode for the RUN commands during build. Requires Docker Engine API v1.25+.
public string NetworkMode { get; set; }
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.
public string Platform { get; set; }
Property Value
System.String
Remarks
Specify this property to build images on a specific platform/architecture.
Default: - current machine platform