Class: AWSCDK::DockerBuildOptions
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::DockerBuildOptions
- Defined in:
- docker_build_options.rb
Overview
Docker build options.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#build_args ⇒ Hash{String => String}?
readonly
Build args.
-
#build_contexts ⇒ Hash{String => String}?
readonly
Build contexts to pass to the
docker buildcommand. -
#cache_disabled ⇒ Boolean?
readonly
Disable the cache and pass
--no-cacheto thedocker buildcommand. -
#cache_from ⇒ Array<AWSCDK::DockerCacheOption>?
readonly
Cache from options to pass to the
docker buildcommand. -
#cache_to ⇒ AWSCDK::DockerCacheOption?
readonly
Cache to options to pass to the
docker buildcommand. -
#file ⇒ String?
readonly
Name of the Dockerfile, must relative to the docker build path.
-
#network ⇒ String?
readonly
Docker Networking options.
-
#platform ⇒ String?
readonly
Set platform if server is multi-platform capable.
-
#target_stage ⇒ String?
readonly
Set build target for multi-stage container builds.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(build_args: nil, build_contexts: nil, cache_disabled: nil, cache_from: nil, cache_to: nil, file: nil, network: nil, platform: nil, target_stage: nil) ⇒ DockerBuildOptions
constructor
A new instance of DockerBuildOptions.
- #to_jsii ⇒ Object
Constructor Details
#initialize(build_args: nil, build_contexts: nil, cache_disabled: nil, cache_from: nil, cache_to: nil, file: nil, network: nil, platform: nil, target_stage: nil) ⇒ DockerBuildOptions
Returns a new instance of DockerBuildOptions.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'docker_build_options.rb', line 16 def initialize(build_args: nil, build_contexts: nil, cache_disabled: nil, cache_from: nil, cache_to: nil, file: nil, network: nil, platform: nil, target_stage: 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? @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::DockerCacheOption.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : cache_from Jsii::Type.check_type(@cache_from, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLkRvY2tlckNhY2hlT3B0aW9uIn0sImtpbmQiOiJhcnJheSJ9fQ==")), "cacheFrom") unless @cache_from.nil? @cache_to = cache_to.is_a?(Hash) ? ::AWSCDK::DockerCacheOption.new(**cache_to.transform_keys(&:to_sym)) : cache_to Jsii::Type.check_type(@cache_to, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5Eb2NrZXJDYWNoZU9wdGlvbiJ9")), "cacheTo") unless @cache_to.nil? @file = file Jsii::Type.check_type(@file, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "file") unless @file.nil? @network = network Jsii::Type.check_type(@network, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "network") unless @network.nil? @platform = platform Jsii::Type.check_type(@platform, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "platform") unless @platform.nil? @target_stage = target_stage Jsii::Type.check_type(@target_stage, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "targetStage") unless @target_stage.nil? end |
Instance Attribute Details
#build_args ⇒ Hash{String => String}? (readonly)
Default: - no build args
Build args.
41 42 43 |
# File 'docker_build_options.rb', line 41 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).
51 52 53 |
# File 'docker_build_options.rb', line 51 def build_contexts @build_contexts end |
#cache_disabled ⇒ Boolean? (readonly)
Default: - cache is used
Disable the cache and pass --no-cache to the docker build command.
56 57 58 |
# File 'docker_build_options.rb', line 56 def cache_disabled @cache_disabled end |
#cache_from ⇒ Array<AWSCDK::DockerCacheOption>? (readonly)
Default: - no cache from args are passed
Cache from options to pass to the docker build command.
61 62 63 |
# File 'docker_build_options.rb', line 61 def cache_from @cache_from end |
#cache_to ⇒ AWSCDK::DockerCacheOption? (readonly)
Default: - no cache to args are passed
Cache to options to pass to the docker build command.
66 67 68 |
# File 'docker_build_options.rb', line 66 def cache_to @cache_to end |
#file ⇒ String? (readonly)
Default: Dockerfile
Name of the Dockerfile, must relative to the docker build path.
71 72 73 |
# File 'docker_build_options.rb', line 71 def file @file end |
#network ⇒ String? (readonly)
Default: - no networking options
Docker Networking options.
76 77 78 |
# File 'docker_build_options.rb', line 76 def network @network end |
#platform ⇒ String? (readonly)
Default: - no platform specified
Set platform if server is multi-platform capable. Requires Docker Engine API v1.38+.
Example value: linux/amd64
83 84 85 |
# File 'docker_build_options.rb', line 83 def platform @platform end |
#target_stage ⇒ String? (readonly)
Default: - Build all stages defined in the Dockerfile
Set build target for multi-stage container builds. Any stage defined afterwards will be ignored.
Example value: build-env
90 91 92 |
# File 'docker_build_options.rb', line 90 def target_stage @target_stage end |
Class Method Details
.jsii_properties ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'docker_build_options.rb', line 92 def self.jsii_properties { :build_args => "buildArgs", :build_contexts => "buildContexts", :cache_disabled => "cacheDisabled", :cache_from => "cacheFrom", :cache_to => "cacheTo", :file => "file", :network => "network", :platform => "platform", :target_stage => "targetStage", } end |
Instance Method Details
#to_jsii ⇒ Object
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'docker_build_options.rb', line 106 def to_jsii result = {} result.merge!({ "buildArgs" => @build_args, "buildContexts" => @build_contexts, "cacheDisabled" => @cache_disabled, "cacheFrom" => @cache_from, "cacheTo" => @cache_to, "file" => @file, "network" => @network, "platform" => @platform, "targetStage" => @target_stage, }) result.compact end |