Class DockerImageAssetSource
public class DockerImageAssetSource : IDockerImageAssetSource
- Inheritance
-
DockerImageAssetSource
- Implements
- Inherited Members
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;
var dockerImageAssetSource = new DockerImageAssetSource {
SourceHash = "sourceHash",
// the properties below are optional
DirectoryName = "directoryName",
DockerBuildArgs = new Dictionary<string, string> {
{ "dockerBuildArgsKey", "dockerBuildArgs" }
},
DockerBuildTarget = "dockerBuildTarget",
DockerFile = "dockerFile",
Executable = new [] { "executable" },
NetworkMode = "networkMode",
Platform = "platform",
RepositoryName = "repositoryName"
};
Remarks
ExampleMetadata: fixture=_generated
Constructors
DockerImageAssetSource()
public DockerImageAssetSource()
Properties
DirectoryName
The directory where the Dockerfile is stored, must be relative to the cloud assembly root.
public string? DirectoryName { get; set; }
Property Value
Remarks
Default: - Exactly one of directoryName
and executable
is required
DockerBuildArgs
Build args to pass to the docker build
command.
public IDictionary<string, string>? DockerBuildArgs { get; set; }
Property Value
Remarks
Since Docker build arguments are resolved before deployment, keys and
values cannot refer to unresolved tokens (such as lambda.functionArn
or
queue.queueUrl
).
Only allowed when directoryName
is specified.
Default: - no build args are passed
DockerBuildTarget
Docker target to build to.
public string? DockerBuildTarget { get; set; }
Property Value
Remarks
Only allowed when directoryName
is specified.
Default: - no target
DockerFile
Path to the Dockerfile (relative to the directory).
public string? DockerFile { get; set; }
Property Value
Remarks
Only allowed when directoryName
is specified.
Default: - no file
Executable
An external command that will produce the packaged asset.
public string[]? Executable { get; set; }
Property Value
- string[]
Remarks
The command should produce the name of a local Docker image on stdout
.
Default: - Exactly one of directoryName
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
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
Remarks
Specify this property to build images on a specific platform.
Default: - no platform specified (the current machine architecture will be used)
RepositoryName
(deprecated) ECR repository name.
[Obsolete("repository name should be specified at the environment-level and not at the image level")]
public string? RepositoryName { get; set; }
Property Value
Remarks
Specify this property if you need to statically address the image, e.g. from a Kubernetes Pod. Note, this is only the repository name, without the registry and the tag parts.
Default: - automatically derived from the asset's ID.
Stability: Deprecated
SourceHash
The hash of the contents of the docker build context.
public string SourceHash { get; set; }
Property Value
Remarks
This hash is used throughout the system to identify this image and avoid duplicate work in case the source did not change.
NOTE: this means that if you wish to update your docker image, you must make a modification to the source (e.g. add some metadata to your Dockerfile).