Class: AWSCDK::DockerImageAssetSource
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::DockerImageAssetSource
- Defined in:
- docker_image_asset_source.rb
Instance Attribute Summary collapse
-
#asset_name ⇒ String?
readonly
Unique identifier of the docker image asset and its potential revisions.
-
#directory_name ⇒ String?
readonly
The directory where the Dockerfile is stored, must be relative to the cloud assembly root.
-
#display_name ⇒ String?
readonly
A display name for this asset.
-
#docker_build_args ⇒ Hash{String => String}?
readonly
Build args to pass to the
docker buildcommand. -
#docker_build_contexts ⇒ Hash{String => String}?
readonly
Build contexts to pass to the
docker buildcommand. -
#docker_build_secrets ⇒ Hash{String => String}?
readonly
Build secrets to pass to the
docker buildcommand. -
#docker_build_ssh ⇒ String?
readonly
SSH agent socket or keys to pass to the
docker buildxcommand. -
#docker_build_target ⇒ String?
readonly
Docker target to build to.
-
#docker_cache_disabled ⇒ Boolean?
readonly
Disable the cache and pass
--no-cacheto thedocker buildcommand. -
#docker_cache_from ⇒ Array<AWSCDK::DockerCacheOption>?
readonly
Cache from options to pass to the
docker buildcommand. -
#docker_cache_to ⇒ AWSCDK::DockerCacheOption?
readonly
Cache to options to pass to the
docker buildcommand. -
#docker_file ⇒ String?
readonly
Path to the Dockerfile (relative to the directory).
-
#docker_outputs ⇒ Array<String>?
readonly
Outputs to pass to the
docker buildcommand. -
#executable ⇒ Array<String>?
readonly
An external command that will produce the packaged asset.
-
#network_mode ⇒ String?
readonly
Networking mode for the RUN commands during build.
-
#platform ⇒ String?
readonly
Platform to build for.
-
#source_hash ⇒ String
readonly
The hash of the contents of the docker build context.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(source_hash:, asset_name: nil, directory_name: nil, display_name: nil, docker_build_args: nil, docker_build_contexts: nil, docker_build_secrets: nil, docker_build_ssh: nil, docker_build_target: nil, docker_cache_disabled: nil, docker_cache_from: nil, docker_cache_to: nil, docker_file: nil, docker_outputs: nil, executable: nil, network_mode: nil, platform: nil) ⇒ DockerImageAssetSource
constructor
A new instance of DockerImageAssetSource.
- #to_jsii ⇒ Object
Constructor Details
#initialize(source_hash:, asset_name: nil, directory_name: nil, display_name: nil, docker_build_args: nil, docker_build_contexts: nil, docker_build_secrets: nil, docker_build_ssh: nil, docker_build_target: nil, docker_cache_disabled: nil, docker_cache_from: nil, docker_cache_to: nil, docker_file: nil, docker_outputs: nil, executable: nil, network_mode: nil, platform: nil) ⇒ DockerImageAssetSource
Returns a new instance of DockerImageAssetSource.
23 24 25 26 27 28 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 |
# File 'docker_image_asset_source.rb', line 23 def initialize(source_hash:, asset_name: nil, directory_name: nil, display_name: nil, docker_build_args: nil, docker_build_contexts: nil, docker_build_secrets: nil, docker_build_ssh: nil, docker_build_target: nil, docker_cache_disabled: nil, docker_cache_from: nil, docker_cache_to: nil, docker_file: nil, docker_outputs: nil, executable: nil, network_mode: nil, platform: nil) @source_hash = source_hash Jsii::Type.check_type(@source_hash, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "sourceHash") @asset_name = asset_name Jsii::Type.check_type(@asset_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "assetName") unless @asset_name.nil? @directory_name = directory_name Jsii::Type.check_type(@directory_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "directoryName") unless @directory_name.nil? @display_name = display_name Jsii::Type.check_type(@display_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "displayName") unless @display_name.nil? @docker_build_args = docker_build_args Jsii::Type.check_type(@docker_build_args, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "dockerBuildArgs") unless @docker_build_args.nil? @docker_build_contexts = docker_build_contexts Jsii::Type.check_type(@docker_build_contexts, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "dockerBuildContexts") unless @docker_build_contexts.nil? @docker_build_secrets = docker_build_secrets Jsii::Type.check_type(@docker_build_secrets, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "dockerBuildSecrets") unless @docker_build_secrets.nil? @docker_build_ssh = docker_build_ssh Jsii::Type.check_type(@docker_build_ssh, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "dockerBuildSsh") unless @docker_build_ssh.nil? @docker_build_target = docker_build_target Jsii::Type.check_type(@docker_build_target, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "dockerBuildTarget") unless @docker_build_target.nil? @docker_cache_disabled = docker_cache_disabled Jsii::Type.check_type(@docker_cache_disabled, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "dockerCacheDisabled") unless @docker_cache_disabled.nil? @docker_cache_from = docker_cache_from.is_a?(Array) ? docker_cache_from.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::DockerCacheOption.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : docker_cache_from Jsii::Type.check_type(@docker_cache_from, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLkRvY2tlckNhY2hlT3B0aW9uIn0sImtpbmQiOiJhcnJheSJ9fQ==")), "dockerCacheFrom") unless @docker_cache_from.nil? @docker_cache_to = docker_cache_to.is_a?(Hash) ? ::AWSCDK::DockerCacheOption.new(**docker_cache_to.transform_keys(&:to_sym)) : docker_cache_to Jsii::Type.check_type(@docker_cache_to, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5Eb2NrZXJDYWNoZU9wdGlvbiJ9")), "dockerCacheTo") unless @docker_cache_to.nil? @docker_file = docker_file Jsii::Type.check_type(@docker_file, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "dockerFile") unless @docker_file.nil? @docker_outputs = docker_outputs Jsii::Type.check_type(@docker_outputs, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "dockerOutputs") unless @docker_outputs.nil? @executable = executable Jsii::Type.check_type(@executable, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "executable") unless @executable.nil? @network_mode = network_mode Jsii::Type.check_type(@network_mode, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "networkMode") unless @network_mode.nil? @platform = platform Jsii::Type.check_type(@platform, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "platform") unless @platform.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.
77 78 79 |
# File 'docker_image_asset_source.rb', line 77 def asset_name @asset_name end |
#directory_name ⇒ String? (readonly)
Default: - Exactly one of directoryName and executable is required
The directory where the Dockerfile is stored, must be relative to the cloud assembly root.
82 83 84 |
# File 'docker_image_asset_source.rb', line 82 def directory_name @directory_name end |
#display_name ⇒ String? (readonly)
Default: - The asset hash is used to display the asset
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.
90 91 92 |
# File 'docker_image_asset_source.rb', line 90 def display_name @display_name end |
#docker_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).
Only allowed when directory_name is specified.
101 102 103 |
# File 'docker_image_asset_source.rb', line 101 def docker_build_args @docker_build_args end |
#docker_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).
Only allowed when directory_name is specified.
113 114 115 |
# File 'docker_image_asset_source.rb', line 113 def docker_build_contexts @docker_build_contexts end |
#docker_build_secrets ⇒ Hash{String => String}? (readonly)
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 directory_name is specified.
124 125 126 |
# File 'docker_image_asset_source.rb', line 124 def docker_build_secrets @docker_build_secrets end |
#docker_build_ssh ⇒ String? (readonly)
Default: - no ssh arg is passed
SSH agent socket or keys to pass to the docker buildx command.
129 130 131 |
# File 'docker_image_asset_source.rb', line 129 def docker_build_ssh @docker_build_ssh end |
#docker_build_target ⇒ String? (readonly)
Default: - no target
Docker target to build to.
Only allowed when directory_name is specified.
136 137 138 |
# File 'docker_image_asset_source.rb', line 136 def docker_build_target @docker_build_target end |
#docker_cache_disabled ⇒ Boolean? (readonly)
Default: - cache is used
Disable the cache and pass --no-cache to the docker build command.
141 142 143 |
# File 'docker_image_asset_source.rb', line 141 def docker_cache_disabled @docker_cache_disabled end |
#docker_cache_from ⇒ Array<AWSCDK::DockerCacheOption>? (readonly)
Default: - no cache from args are passed
Cache from options to pass to the docker build command.
146 147 148 |
# File 'docker_image_asset_source.rb', line 146 def docker_cache_from @docker_cache_from end |
#docker_cache_to ⇒ AWSCDK::DockerCacheOption? (readonly)
Default: - no cache to args are passed
Cache to options to pass to the docker build command.
151 152 153 |
# File 'docker_image_asset_source.rb', line 151 def docker_cache_to @docker_cache_to end |
#docker_file ⇒ String? (readonly)
Default: - no file
Path to the Dockerfile (relative to the directory).
Only allowed when directory_name is specified.
158 159 160 |
# File 'docker_image_asset_source.rb', line 158 def docker_file @docker_file end |
#docker_outputs ⇒ Array<String>? (readonly)
Default: - no build args are passed
Outputs to pass to the docker build command.
163 164 165 |
# File 'docker_image_asset_source.rb', line 163 def docker_outputs @docker_outputs end |
#executable ⇒ Array<String>? (readonly)
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.
170 171 172 |
# File 'docker_image_asset_source.rb', line 170 def executable @executable end |
#network_mode ⇒ String? (readonly)
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.
177 178 179 |
# File 'docker_image_asset_source.rb', line 177 def network_mode @network_mode end |
#platform ⇒ String? (readonly)
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.
184 185 186 |
# File 'docker_image_asset_source.rb', line 184 def platform @platform end |
#source_hash ⇒ String (readonly)
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).
70 71 72 |
# File 'docker_image_asset_source.rb', line 70 def source_hash @source_hash end |
Class Method Details
.jsii_properties ⇒ Object
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
# File 'docker_image_asset_source.rb', line 186 def self.jsii_properties { :source_hash => "sourceHash", :asset_name => "assetName", :directory_name => "directoryName", :display_name => "displayName", :docker_build_args => "dockerBuildArgs", :docker_build_contexts => "dockerBuildContexts", :docker_build_secrets => "dockerBuildSecrets", :docker_build_ssh => "dockerBuildSsh", :docker_build_target => "dockerBuildTarget", :docker_cache_disabled => "dockerCacheDisabled", :docker_cache_from => "dockerCacheFrom", :docker_cache_to => "dockerCacheTo", :docker_file => "dockerFile", :docker_outputs => "dockerOutputs", :executable => "executable", :network_mode => "networkMode", :platform => "platform", } end |
Instance Method Details
#to_jsii ⇒ Object
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
# File 'docker_image_asset_source.rb', line 208 def to_jsii result = {} result.merge!({ "sourceHash" => @source_hash, "assetName" => @asset_name, "directoryName" => @directory_name, "displayName" => @display_name, "dockerBuildArgs" => @docker_build_args, "dockerBuildContexts" => @docker_build_contexts, "dockerBuildSecrets" => @docker_build_secrets, "dockerBuildSsh" => @docker_build_ssh, "dockerBuildTarget" => @docker_build_target, "dockerCacheDisabled" => @docker_cache_disabled, "dockerCacheFrom" => @docker_cache_from, "dockerCacheTo" => @docker_cache_to, "dockerFile" => @docker_file, "dockerOutputs" => @docker_outputs, "executable" => @executable, "networkMode" => @network_mode, "platform" => @platform, }) result.compact end |