Class: AWSCDK::Lambda::AssetImageCodeProps
- Inherits:
-
ECRAssets::DockerImageAssetOptions
- Object
- ECRAssets::DockerImageAssetOptions
- AWSCDK::Lambda::AssetImageCodeProps
- Defined in:
- lambda/asset_image_code_props.rb
Overview
Properties to initialize a new AssetImage.
Instance Attribute Summary collapse
-
#asset_name ⇒ String?
readonly
Unique identifier of the docker image asset and its potential revisions.
-
#build_args ⇒ Hash{String => String}?
readonly
Build args to pass to the
docker buildcommand. -
#build_contexts ⇒ Hash{String => String}?
readonly
Build contexts to pass to the
docker buildcommand. -
#build_secrets ⇒ Hash{String => String}?
readonly
Build secrets.
-
#build_ssh ⇒ String?
readonly
SSH agent socket or keys to pass to the
docker buildcommand. -
#cache_disabled ⇒ Boolean?
readonly
Disable the cache and pass
--no-cacheto thedocker buildcommand. -
#cache_from ⇒ Array<AWSCDK::ECRAssets::DockerCacheOption>?
readonly
Cache from options to pass to the
docker buildcommand. -
#cache_to ⇒ AWSCDK::ECRAssets::DockerCacheOption?
readonly
Cache to options to pass to the
docker buildcommand. -
#cmd ⇒ Array<String>?
readonly
Specify or override the CMD on the specified Docker image or Dockerfile.
-
#display_name ⇒ String?
readonly
A display name for this asset.
-
#entrypoint ⇒ Array<String>?
readonly
Specify or override the ENTRYPOINT on the specified Docker image or Dockerfile.
-
#exclude ⇒ Array<String>?
readonly
File paths matching the patterns will be excluded.
-
#extra_hash ⇒ String?
readonly
Extra information to encode into the fingerprint (e.g. build instructions and other inputs).
-
#file ⇒ String?
readonly
Path to the Dockerfile (relative to the directory).
-
#follow_symlinks ⇒ AWSCDK::SymlinkFollowMode?
readonly
A strategy for how to handle symlinks.
-
#ignore_mode ⇒ AWSCDK::IgnoreMode?
readonly
The ignore behavior to use for
excludepatterns. -
#invalidation ⇒ AWSCDK::ECRAssets::DockerImageAssetInvalidationOptions?
readonly
Options to control which parameters are used to invalidate the asset hash.
-
#network_mode ⇒ AWSCDK::ECRAssets::NetworkMode?
readonly
Networking mode for the RUN commands during build.
-
#outputs ⇒ Array<String>?
readonly
Outputs to pass to the
docker buildcommand. -
#platform ⇒ AWSCDK::ECRAssets::Platform?
readonly
Platform to build for.
-
#target ⇒ String?
readonly
Docker target to build to.
-
#working_directory ⇒ String?
readonly
Specify or override the WORKDIR on the specified Docker image or Dockerfile.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(exclude: nil, follow_symlinks: nil, ignore_mode: nil, extra_hash: nil, asset_name: nil, build_args: nil, build_contexts: nil, build_secrets: nil, build_ssh: nil, cache_disabled: nil, cache_from: nil, cache_to: nil, display_name: nil, file: nil, invalidation: nil, network_mode: nil, outputs: nil, platform: nil, target: nil, cmd: nil, entrypoint: nil, working_directory: nil) ⇒ AssetImageCodeProps
constructor
A new instance of AssetImageCodeProps.
- #to_jsii ⇒ Object
Constructor Details
#initialize(exclude: nil, follow_symlinks: nil, ignore_mode: nil, extra_hash: nil, asset_name: nil, build_args: nil, build_contexts: nil, build_secrets: nil, build_ssh: nil, cache_disabled: nil, cache_from: nil, cache_to: nil, display_name: nil, file: nil, invalidation: nil, network_mode: nil, outputs: nil, platform: nil, target: nil, cmd: nil, entrypoint: nil, working_directory: nil) ⇒ AssetImageCodeProps
Returns a new instance of AssetImageCodeProps.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lambda/asset_image_code_props.rb', line 29 def initialize(exclude: nil, follow_symlinks: nil, ignore_mode: nil, extra_hash: nil, asset_name: nil, build_args: nil, build_contexts: nil, build_secrets: nil, build_ssh: nil, cache_disabled: nil, cache_from: nil, cache_to: nil, display_name: nil, file: nil, invalidation: nil, network_mode: nil, outputs: nil, platform: nil, target: nil, cmd: nil, entrypoint: nil, working_directory: nil) @exclude = exclude Jsii::Type.check_type(@exclude, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "exclude") unless @exclude.nil? @follow_symlinks = follow_symlinks Jsii::Type.check_type(@follow_symlinks, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5TeW1saW5rRm9sbG93TW9kZSJ9")), "followSymlinks") unless @follow_symlinks.nil? @ignore_mode = ignore_mode Jsii::Type.check_type(@ignore_mode, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5JZ25vcmVNb2RlIn0=")), "ignoreMode") unless @ignore_mode.nil? @extra_hash = extra_hash Jsii::Type.check_type(@extra_hash, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "extraHash") unless @extra_hash.nil? @asset_name = asset_name Jsii::Type.check_type(@asset_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "assetName") unless @asset_name.nil? @build_args = build_args Jsii::Type.check_type(@build_args, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "buildArgs") unless @build_args.nil? @build_contexts = build_contexts Jsii::Type.check_type(@build_contexts, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "buildContexts") unless @build_contexts.nil? @build_secrets = build_secrets Jsii::Type.check_type(@build_secrets, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "buildSecrets") unless @build_secrets.nil? @build_ssh = build_ssh Jsii::Type.check_type(@build_ssh, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "buildSsh") unless @build_ssh.nil? @cache_disabled = cache_disabled Jsii::Type.check_type(@cache_disabled, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "cacheDisabled") unless @cache_disabled.nil? @cache_from = cache_from.is_a?(Array) ? cache_from.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::ECRAssets::DockerCacheOption.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : cache_from Jsii::Type.check_type(@cache_from, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lY3JfYXNzZXRzLkRvY2tlckNhY2hlT3B0aW9uIn0sImtpbmQiOiJhcnJheSJ9fQ==")), "cacheFrom") unless @cache_from.nil? @cache_to = cache_to.is_a?(Hash) ? ::AWSCDK::ECRAssets::DockerCacheOption.new(**cache_to.transform_keys(&:to_sym)) : cache_to Jsii::Type.check_type(@cache_to, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNyX2Fzc2V0cy5Eb2NrZXJDYWNoZU9wdGlvbiJ9")), "cacheTo") unless @cache_to.nil? @display_name = display_name Jsii::Type.check_type(@display_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "displayName") unless @display_name.nil? @file = file Jsii::Type.check_type(@file, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "file") unless @file.nil? @invalidation = invalidation.is_a?(Hash) ? ::AWSCDK::ECRAssets::DockerImageAssetInvalidationOptions.new(**invalidation.transform_keys(&:to_sym)) : invalidation Jsii::Type.check_type(@invalidation, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNyX2Fzc2V0cy5Eb2NrZXJJbWFnZUFzc2V0SW52YWxpZGF0aW9uT3B0aW9ucyJ9")), "invalidation") unless @invalidation.nil? @network_mode = network_mode Jsii::Type.check_type(@network_mode, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNyX2Fzc2V0cy5OZXR3b3JrTW9kZSJ9")), "networkMode") unless @network_mode.nil? @outputs = outputs Jsii::Type.check_type(@outputs, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "outputs") unless @outputs.nil? @platform = platform Jsii::Type.check_type(@platform, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNyX2Fzc2V0cy5QbGF0Zm9ybSJ9")), "platform") unless @platform.nil? @target = target Jsii::Type.check_type(@target, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "target") unless @target.nil? @cmd = cmd Jsii::Type.check_type(@cmd, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "cmd") unless @cmd.nil? @entrypoint = entrypoint Jsii::Type.check_type(@entrypoint, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "entrypoint") unless @entrypoint.nil? @working_directory = working_directory Jsii::Type.check_type(@working_directory, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "workingDirectory") unless @working_directory.nil? end |
Instance Attribute Details
#asset_name ⇒ String? (readonly)
Default: - no asset name
Unique identifier of the docker image asset and its potential revisions.
Required if using AppScopedStagingSynthesizer.
105 106 107 |
# File 'lambda/asset_image_code_props.rb', line 105 def asset_name @asset_name end |
#build_args ⇒ Hash{String => String}? (readonly)
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).
114 115 116 |
# File 'lambda/asset_image_code_props.rb', line 114 def build_args @build_args end |
#build_contexts ⇒ Hash{String => String}? (readonly)
Default: - no additional build contexts
Build contexts to pass to the docker build command.
Build contexts can be used to specify additional directories or images to use during the build. Each entry specifies a named build context and its source (a directory path, a URL, or a docker image).
Since Docker build contexts are resolved before deployment, keys and
values cannot refer to unresolved tokens (such as lambda.functionArn or
queue.queueUrl).
128 129 130 |
# File 'lambda/asset_image_code_props.rb', line 128 def build_contexts @build_contexts end |
#build_secrets ⇒ Hash{String => String}? (readonly)
Default: - no build secrets
Build secrets.
Docker BuildKit must be enabled to use build secrets.
142 143 144 |
# File 'lambda/asset_image_code_props.rb', line 142 def build_secrets @build_secrets end |
#build_ssh ⇒ String? (readonly)
Default: - no --ssh flag
SSH agent socket or keys to pass to the docker build command.
Docker BuildKit must be enabled to use the ssh flag
150 151 152 |
# File 'lambda/asset_image_code_props.rb', line 150 def build_ssh @build_ssh end |
#cache_disabled ⇒ Boolean? (readonly)
Default: - cache is used
Disable the cache and pass --no-cache to the docker build command.
155 156 157 |
# File 'lambda/asset_image_code_props.rb', line 155 def cache_disabled @cache_disabled end |
#cache_from ⇒ Array<AWSCDK::ECRAssets::DockerCacheOption>? (readonly)
Default: - no cache from options are passed to the build command
Cache from options to pass to the docker build command.
161 162 163 |
# File 'lambda/asset_image_code_props.rb', line 161 def cache_from @cache_from end |
#cache_to ⇒ AWSCDK::ECRAssets::DockerCacheOption? (readonly)
Default: - no cache to options are passed to the build command
Cache to options to pass to the docker build command.
167 168 169 |
# File 'lambda/asset_image_code_props.rb', line 167 def cache_to @cache_to end |
#cmd ⇒ Array<String>? (readonly)
Default: - use the CMD specified in the docker image or Dockerfile.
Specify or override the CMD on the specified Docker image or Dockerfile.
This needs to be in the 'exec form', viz., [ 'executable', 'param1', 'param2' ].
231 232 233 |
# File 'lambda/asset_image_code_props.rb', line 231 def cmd @cmd end |
#display_name ⇒ String? (readonly)
Default: - Stack-relative construct path
A display name for this asset.
If supplied, the display name will be used in locations where the asset identifier is printed, like in the CLI progress information. If the same asset is added multiple times, the display name of the first occurrence is used.
If asset_name is given, it will also be used as the default display_name.
Otherwise, the default is the construct path of the ImageAsset construct,
with respect to the enclosing stack. If the asset is produced by a
construct helper function (such as lambda.Code.fromAssetImage()), this
will look like MyFunction/AssetImage.
We use the stack-relative construct path so that in the common case where
you have multiple stacks with the same asset, we won't show something like
/MyBetaStack/MyFunction/Code when you are actually deploying to
production.
188 189 190 |
# File 'lambda/asset_image_code_props.rb', line 188 def display_name @display_name end |
#entrypoint ⇒ Array<String>? (readonly)
Default: - use the ENTRYPOINT in the docker image or Dockerfile.
Specify or override the ENTRYPOINT on the specified Docker image or Dockerfile.
An ENTRYPOINT allows you to configure a container that will run as an executable.
This needs to be in the 'exec form', viz., [ 'executable', 'param1', 'param2' ].
240 241 242 |
# File 'lambda/asset_image_code_props.rb', line 240 def entrypoint @entrypoint end |
#exclude ⇒ Array<String>? (readonly)
Default: - nothing is excluded
File paths matching the patterns will be excluded.
See ignore_mode to set the matching behavior.
Has no effect on Assets bundled using the bundling property.
83 84 85 |
# File 'lambda/asset_image_code_props.rb', line 83 def exclude @exclude end |
#extra_hash ⇒ String? (readonly)
Default: - hash is only based on source content
Extra information to encode into the fingerprint (e.g. build instructions and other inputs).
98 99 100 |
# File 'lambda/asset_image_code_props.rb', line 98 def extra_hash @extra_hash end |
#file ⇒ String? (readonly)
Default: 'Dockerfile'
Path to the Dockerfile (relative to the directory).
193 194 195 |
# File 'lambda/asset_image_code_props.rb', line 193 def file @file end |
#follow_symlinks ⇒ AWSCDK::SymlinkFollowMode? (readonly)
Default: SymlinkFollowMode.NEVER
A strategy for how to handle symlinks.
88 89 90 |
# File 'lambda/asset_image_code_props.rb', line 88 def follow_symlinks @follow_symlinks end |
#ignore_mode ⇒ AWSCDK::IgnoreMode? (readonly)
Default: IgnoreMode.GLOB
The ignore behavior to use for exclude patterns.
93 94 95 |
# File 'lambda/asset_image_code_props.rb', line 93 def ignore_mode @ignore_mode end |
#invalidation ⇒ AWSCDK::ECRAssets::DockerImageAssetInvalidationOptions? (readonly)
Default: - hash all parameters
Options to control which parameters are used to invalidate the asset hash.
198 199 200 |
# File 'lambda/asset_image_code_props.rb', line 198 def invalidation @invalidation end |
#network_mode ⇒ AWSCDK::ECRAssets::NetworkMode? (readonly)
Default: - no networking mode specified (the default networking mode NetworkMode.DEFAULT will be used)
Networking mode for the RUN commands during build.
Support docker API 1.25+.
205 206 207 |
# File 'lambda/asset_image_code_props.rb', line 205 def network_mode @network_mode end |
#outputs ⇒ Array<String>? (readonly)
Default: - no outputs are passed to the build command (default outputs are used)
Outputs to pass to the docker build command.
211 212 213 |
# File 'lambda/asset_image_code_props.rb', line 211 def outputs @outputs end |
#platform ⇒ AWSCDK::ECRAssets::Platform? (readonly)
Default: - no platform specified (the current machine architecture will be used)
Platform to build for.
Requires Docker Buildx.
218 219 220 |
# File 'lambda/asset_image_code_props.rb', line 218 def platform @platform end |
#target ⇒ String? (readonly)
Default: - no target
Docker target to build to.
223 224 225 |
# File 'lambda/asset_image_code_props.rb', line 223 def target @target end |
#working_directory ⇒ String? (readonly)
Default: - use the WORKDIR in the docker image or Dockerfile.
Specify or override the WORKDIR on the specified Docker image or Dockerfile.
A WORKDIR allows you to configure the working directory the container will use.
248 249 250 |
# File 'lambda/asset_image_code_props.rb', line 248 def working_directory @working_directory end |
Class Method Details
.jsii_properties ⇒ Object
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 |
# File 'lambda/asset_image_code_props.rb', line 250 def self.jsii_properties { :exclude => "exclude", :follow_symlinks => "followSymlinks", :ignore_mode => "ignoreMode", :extra_hash => "extraHash", :asset_name => "assetName", :build_args => "buildArgs", :build_contexts => "buildContexts", :build_secrets => "buildSecrets", :build_ssh => "buildSsh", :cache_disabled => "cacheDisabled", :cache_from => "cacheFrom", :cache_to => "cacheTo", :display_name => "displayName", :file => "file", :invalidation => "invalidation", :network_mode => "networkMode", :outputs => "outputs", :platform => "platform", :target => "target", :cmd => "cmd", :entrypoint => "entrypoint", :working_directory => "workingDirectory", } end |
Instance Method Details
#to_jsii ⇒ Object
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 |
# File 'lambda/asset_image_code_props.rb', line 277 def to_jsii result = {} result.merge!(super) result.merge!({ "exclude" => @exclude, "followSymlinks" => @follow_symlinks, "ignoreMode" => @ignore_mode, "extraHash" => @extra_hash, "assetName" => @asset_name, "buildArgs" => @build_args, "buildContexts" => @build_contexts, "buildSecrets" => @build_secrets, "buildSsh" => @build_ssh, "cacheDisabled" => @cache_disabled, "cacheFrom" => @cache_from, "cacheTo" => @cache_to, "displayName" => @display_name, "file" => @file, "invalidation" => @invalidation, "networkMode" => @network_mode, "outputs" => @outputs, "platform" => @platform, "target" => @target, "cmd" => @cmd, "entrypoint" => @entrypoint, "workingDirectory" => @working_directory, }) result.compact end |