interface DockerImageAssetSource
Language | Type name |
---|---|
.NET | Amazon.CDK.DockerImageAssetSource |
Go | github.com/aws/aws-cdk-go/awscdk/v2#DockerImageAssetSource |
Java | software.amazon.awscdk.DockerImageAssetSource |
Python | aws_cdk.DockerImageAssetSource |
TypeScript (source) | aws-cdk-lib » DockerImageAssetSource |
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
const dockerImageAssetSource: cdk.DockerImageAssetSource = {
sourceHash: 'sourceHash',
// the properties below are optional
assetName: 'assetName',
directoryName: 'directoryName',
dockerBuildArgs: {
dockerBuildArgsKey: 'dockerBuildArgs',
},
dockerBuildSecrets: {
dockerBuildSecretsKey: 'dockerBuildSecrets',
},
dockerBuildSsh: 'dockerBuildSsh',
dockerBuildTarget: 'dockerBuildTarget',
dockerCacheDisabled: false,
dockerCacheFrom: [{
type: 'type',
// the properties below are optional
params: {
paramsKey: 'params',
},
}],
dockerCacheTo: {
type: 'type',
// the properties below are optional
params: {
paramsKey: 'params',
},
},
dockerFile: 'dockerFile',
dockerOutputs: ['dockerOutputs'],
executable: ['executable'],
networkMode: 'networkMode',
platform: 'platform',
};
Properties
Name | Type | Description |
---|---|---|
source | string | The hash of the contents of the docker build context. |
asset | string | Unique identifier of the docker image asset and its potential revisions. |
directory | string | The directory where the Dockerfile is stored, must be relative to the cloud assembly root. |
docker | { [string]: string } | Build args to pass to the docker build command. |
docker | { [string]: string } | Build secrets to pass to the docker build command. |
docker | string | SSH agent socket or keys to pass to the docker buildx command. |
docker | string | Docker target to build to. |
docker | boolean | Disable the cache and pass --no-cache to the docker build command. |
docker | Docker [] | Cache from options to pass to the docker build command. |
docker | Docker | Cache to options to pass to the docker build command. |
docker | string | Path to the Dockerfile (relative to the directory). |
docker | string[] | Outputs to pass to the docker build command. |
executable? | string[] | An external command that will produce the packaged asset. |
network | string | Networking mode for the RUN commands during build. Requires Docker Engine API v1.25+. |
platform? | string | Platform to build for. Requires Docker Buildx. |
sourceHash
Type:
string
The hash of the contents of the docker build context.
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).
assetName?
Type:
string
(optional, default: no asset name)
Unique identifier of the docker image asset and its potential revisions.
Required if using AppScopedStagingSynthesizer.
directoryName?
Type:
string
(optional, default: Exactly one of directoryName
and executable
is required)
The directory where the Dockerfile is stored, must be relative to the cloud assembly root.
dockerBuildArgs?
Type:
{ [string]: string }
(optional, default: no build args are passed)
Build args to pass to the docker build
command.
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.
dockerBuildSecrets?
Type:
{ [string]: string }
(optional, default: no build secrets are passed)
Build secrets to pass to the docker build
command.
Since Docker build secrets 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.
dockerBuildSsh?
Type:
string
(optional, default: no ssh arg is passed)
SSH agent socket or keys to pass to the docker buildx
command.
dockerBuildTarget?
Type:
string
(optional, default: no target)
Docker target to build to.
Only allowed when directoryName
is specified.
dockerCacheDisabled?
Type:
boolean
(optional, default: cache is used)
Disable the cache and pass --no-cache
to the docker build
command.
dockerCacheFrom?
Type:
Docker
[]
(optional, default: no cache from args are passed)
Cache from options to pass to the docker build
command.
dockerCacheTo?
Type:
Docker
(optional, default: no cache to args are passed)
Cache to options to pass to the docker build
command.
dockerFile?
Type:
string
(optional, default: no file)
Path to the Dockerfile (relative to the directory).
Only allowed when directoryName
is specified.
dockerOutputs?
Type:
string[]
(optional, default: no build args are passed)
Outputs to pass to the docker build
command.
executable?
Type:
string[]
(optional, default: Exactly one of directoryName
and executable
is required)
An external command that will produce the packaged asset.
The command should produce the name of a local Docker image on stdout
.
networkMode?
Type:
string
(optional, default: no networking mode specified)
Networking mode for the RUN commands during build. Requires Docker Engine API v1.25+.
Specify this property to build images on a specific networking mode.
platform?
Type:
string
(optional, default: no platform specified (the current machine architecture will be used))
Platform to build for. Requires Docker Buildx.
Specify this property to build images on a specific platform.