Class: AWSCDK::Lambda::DockerBuildAssetOptions

Inherits:
DockerBuildOptions
  • Object
show all
Defined in:
lambda/docker_build_asset_options.rb

Overview

Options when creating an asset from a Docker build.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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, image_path: nil, output_path: nil) ⇒ DockerBuildAssetOptions

Returns a new instance of DockerBuildAssetOptions.

Parameters:

  • build_args (Hash{String => String}, nil) (defaults to: nil)

    Build args.

  • build_contexts (Hash{String => String}, nil) (defaults to: nil)

    Build contexts to pass to the docker build command.

  • cache_disabled (Boolean, nil) (defaults to: nil)

    Disable the cache and pass --no-cache to the docker build command.

  • cache_from (Array<AWSCDK::DockerCacheOption>, nil) (defaults to: nil)

    Cache from options to pass to the docker build command.

  • cache_to (AWSCDK::DockerCacheOption, nil) (defaults to: nil)

    Cache to options to pass to the docker build command.

  • file (String, nil) (defaults to: nil)

    Name of the Dockerfile, must relative to the docker build path.

  • network (String, nil) (defaults to: nil)
  • platform (String, nil) (defaults to: nil)

    Set platform if server is multi-platform capable. Requires Docker Engine API v1.38+.

  • target_stage (String, nil) (defaults to: nil)

    Set build target for multi-stage container builds. Any stage defined afterwards will be ignored.

  • image_path (String, nil) (defaults to: nil)

    The path in the Docker image where the asset is located after the build operation.

  • output_path (String, nil) (defaults to: nil)

    The path on the local filesystem where the asset will be copied using docker cp.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lambda/docker_build_asset_options.rb', line 18

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, image_path: nil, output_path: 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?
  @image_path = image_path
  Jsii::Type.check_type(@image_path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "imagePath") unless @image_path.nil?
  @output_path = output_path
  Jsii::Type.check_type(@output_path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "outputPath") unless @output_path.nil?
end

Instance Attribute Details

#build_argsHash{String => String}? (readonly)

Note:

Default: - no build args

Build args.

Returns:

  • (Hash{String => String}, nil)


47
48
49
# File 'lambda/docker_build_asset_options.rb', line 47

def build_args
  @build_args
end

#build_contextsHash{String => String}? (readonly)

Note:

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).

Returns:

  • (Hash{String => String}, nil)

See Also:



57
58
59
# File 'lambda/docker_build_asset_options.rb', line 57

def build_contexts
  @build_contexts
end

#cache_disabledBoolean? (readonly)

Note:

Default: - cache is used

Disable the cache and pass --no-cache to the docker build command.

Returns:

  • (Boolean, nil)


62
63
64
# File 'lambda/docker_build_asset_options.rb', line 62

def cache_disabled
  @cache_disabled
end

#cache_fromArray<AWSCDK::DockerCacheOption>? (readonly)

Note:

Default: - no cache from args are passed

Cache from options to pass to the docker build command.

Returns:



67
68
69
# File 'lambda/docker_build_asset_options.rb', line 67

def cache_from
  @cache_from
end

#cache_toAWSCDK::DockerCacheOption? (readonly)

Note:

Default: - no cache to args are passed

Cache to options to pass to the docker build command.

Returns:



72
73
74
# File 'lambda/docker_build_asset_options.rb', line 72

def cache_to
  @cache_to
end

#fileString? (readonly)

Note:

Default: Dockerfile

Name of the Dockerfile, must relative to the docker build path.

Returns:

  • (String, nil)


77
78
79
# File 'lambda/docker_build_asset_options.rb', line 77

def file
  @file
end

#image_pathString? (readonly)

Note:

Default: /asset

The path in the Docker image where the asset is located after the build operation.

Returns:

  • (String, nil)


101
102
103
# File 'lambda/docker_build_asset_options.rb', line 101

def image_path
  @image_path
end

#networkString? (readonly)

Note:

Default: - no networking options

Docker Networking options.

Returns:

  • (String, nil)


82
83
84
# File 'lambda/docker_build_asset_options.rb', line 82

def network
  @network
end

#output_pathString? (readonly)

Note:

Default: - a unique temporary directory in the system temp directory

The path on the local filesystem where the asset will be copied using docker cp.

Returns:

  • (String, nil)


106
107
108
# File 'lambda/docker_build_asset_options.rb', line 106

def output_path
  @output_path
end

#platformString? (readonly)

Note:

Default: - no platform specified

Set platform if server is multi-platform capable. Requires Docker Engine API v1.38+.

Example value: linux/amd64

Returns:

  • (String, nil)


89
90
91
# File 'lambda/docker_build_asset_options.rb', line 89

def platform
  @platform
end

#target_stageString? (readonly)

Note:

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

Returns:

  • (String, nil)


96
97
98
# File 'lambda/docker_build_asset_options.rb', line 96

def target_stage
  @target_stage
end

Class Method Details

.jsii_propertiesObject



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lambda/docker_build_asset_options.rb', line 108

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",
    :image_path => "imagePath",
    :output_path => "outputPath",
  }
end

Instance Method Details

#to_jsiiObject



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lambda/docker_build_asset_options.rb', line 124

def to_jsii
  result = {}
  result.merge!(super)
  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,
    "imagePath" => @image_path,
    "outputPath" => @output_path,
  })
  result.compact
end