Class: AWSCDK::CloudAssemblySchema::DockerImageSource

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
cloud_assembly_schema/docker_image_source.rb

Overview

Properties for how to produce a Docker image from a source.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cache_disabled: nil, cache_from: nil, cache_to: nil, directory: nil, docker_build_args: nil, docker_build_contexts: nil, docker_build_secrets: nil, docker_build_ssh: nil, docker_build_target: nil, docker_file: nil, docker_outputs: nil, executable: nil, network_mode: nil, platform: nil) ⇒ DockerImageSource

Returns a new instance of DockerImageSource.

Parameters:

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

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

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

    Cache from options to pass to the docker build command.

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

    Cache to options to pass to the docker build command.

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

    The directory containing the Docker image build instructions.

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

    Additional build arguments.

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

    Additional build contexts.

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

    Additional build secrets.

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

    SSH agent socket or keys.

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

    Target build stage in a Dockerfile with multiple build stages.

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

    The name of the file with build instructions.

  • docker_outputs (Array<String>, nil) (defaults to: nil)

    Outputs.

  • executable (Array<String>, nil) (defaults to: nil)

    A command-line executable that returns the name of a local Docker image on stdout after being run.

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

    Networking mode for the RUN commands during build. Requires Docker Engine API v1.25+.

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

    Platform to build for. Requires Docker Buildx.



21
22
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
# File 'cloud_assembly_schema/docker_image_source.rb', line 21

def initialize(cache_disabled: nil, cache_from: nil, cache_to: nil, directory: nil, docker_build_args: nil, docker_build_contexts: nil, docker_build_secrets: nil, docker_build_ssh: nil, docker_build_target: nil, docker_file: nil, docker_outputs: nil, executable: nil, network_mode: nil, platform: 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::CloudAssemblySchema::DockerCacheOption.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : cache_from
  Jsii::Type.check_type(@cache_from, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmNsb3VkX2Fzc2VtYmx5X3NjaGVtYS5Eb2NrZXJDYWNoZU9wdGlvbiJ9LCJraW5kIjoiYXJyYXkifX0=")), "cacheFrom") unless @cache_from.nil?
  @cache_to = cache_to.is_a?(Hash) ? ::AWSCDK::CloudAssemblySchema::DockerCacheOption.new(**cache_to.transform_keys(&:to_sym)) : cache_to
  Jsii::Type.check_type(@cache_to, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5jbG91ZF9hc3NlbWJseV9zY2hlbWEuRG9ja2VyQ2FjaGVPcHRpb24ifQ==")), "cacheTo") unless @cache_to.nil?
  @directory = directory
  Jsii::Type.check_type(@directory, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "directory") unless @directory.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_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

#cache_disabledBoolean? (readonly)

Note:

Default: - cache is used

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

Returns:

  • (Boolean, nil)


56
57
58
# File 'cloud_assembly_schema/docker_image_source.rb', line 56

def cache_disabled
  @cache_disabled
end

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

Note:

Default: - no cache from options are passed to the build command

Cache from options to pass to the docker build command.



62
63
64
# File 'cloud_assembly_schema/docker_image_source.rb', line 62

def cache_from
  @cache_from
end

#cache_toAWSCDK::CloudAssemblySchema::DockerCacheOption? (readonly)

Note:

Default: - no cache to options are passed to the build command

Cache to options to pass to the docker build command.



68
69
70
# File 'cloud_assembly_schema/docker_image_source.rb', line 68

def cache_to
  @cache_to
end

#directoryString? (readonly)

Note:

Default: - Exactly one of directory and executable is required

The directory containing the Docker image build instructions.

This path is relative to the asset manifest location.

Returns:

  • (String, nil)


75
76
77
# File 'cloud_assembly_schema/docker_image_source.rb', line 75

def directory
  @directory
end

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

Note:

Default: - No additional build arguments

Additional build arguments.

Only allowed when directory is set.

Returns:

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


82
83
84
# File 'cloud_assembly_schema/docker_image_source.rb', line 82

def docker_build_args
  @docker_build_args
end

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

Note:

Default: - No additional build contexts

Additional build contexts.

Only allowed when directory is set.

Returns:

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


89
90
91
# File 'cloud_assembly_schema/docker_image_source.rb', line 89

def docker_build_contexts
  @docker_build_contexts
end

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

Note:

Default: - No additional build secrets

Additional build secrets.

Only allowed when directory is set.

Returns:

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


96
97
98
# File 'cloud_assembly_schema/docker_image_source.rb', line 96

def docker_build_secrets
  @docker_build_secrets
end

#docker_build_sshString? (readonly)

Note:

Default: - No ssh flag is set

SSH agent socket or keys.

Requires building with docker buildkit.

Returns:

  • (String, nil)


103
104
105
# File 'cloud_assembly_schema/docker_image_source.rb', line 103

def docker_build_ssh
  @docker_build_ssh
end

#docker_build_targetString? (readonly)

Note:

Default: - The last stage in the Dockerfile

Target build stage in a Dockerfile with multiple build stages.

Only allowed when directory is set.

Returns:

  • (String, nil)


110
111
112
# File 'cloud_assembly_schema/docker_image_source.rb', line 110

def docker_build_target
  @docker_build_target
end

#docker_fileString? (readonly)

Note:

Default: "Dockerfile"

The name of the file with build instructions.

Only allowed when directory is set.

Returns:

  • (String, nil)


117
118
119
# File 'cloud_assembly_schema/docker_image_source.rb', line 117

def docker_file
  @docker_file
end

#docker_outputsArray<String>? (readonly)

Note:

Default: - no outputs are passed to the build command (default outputs are used)

Outputs.



123
124
125
# File 'cloud_assembly_schema/docker_image_source.rb', line 123

def docker_outputs
  @docker_outputs
end

#executableArray<String>? (readonly)

Note:

Default: - Exactly one of directory and executable is required

A command-line executable that returns the name of a local Docker image on stdout after being run.

Returns:

  • (Array<String>, nil)


128
129
130
# File 'cloud_assembly_schema/docker_image_source.rb', line 128

def executable
  @executable
end

#network_modeString? (readonly)

Note:

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.

Returns:

  • (String, nil)


135
136
137
# File 'cloud_assembly_schema/docker_image_source.rb', line 135

def network_mode
  @network_mode
end

#platformString? (readonly)

Note:

Default: - current machine platform

Platform to build for. Requires Docker Buildx.

Specify this property to build images on a specific platform/architecture.

Returns:

  • (String, nil)


142
143
144
# File 'cloud_assembly_schema/docker_image_source.rb', line 142

def platform
  @platform
end

Class Method Details

.jsii_propertiesObject



144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'cloud_assembly_schema/docker_image_source.rb', line 144

def self.jsii_properties
  {
    :cache_disabled => "cacheDisabled",
    :cache_from => "cacheFrom",
    :cache_to => "cacheTo",
    :directory => "directory",
    :docker_build_args => "dockerBuildArgs",
    :docker_build_contexts => "dockerBuildContexts",
    :docker_build_secrets => "dockerBuildSecrets",
    :docker_build_ssh => "dockerBuildSsh",
    :docker_build_target => "dockerBuildTarget",
    :docker_file => "dockerFile",
    :docker_outputs => "dockerOutputs",
    :executable => "executable",
    :network_mode => "networkMode",
    :platform => "platform",
  }
end

Instance Method Details

#to_jsiiObject



163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'cloud_assembly_schema/docker_image_source.rb', line 163

def to_jsii
  result = {}
  result.merge!({
    "cacheDisabled" => @cache_disabled,
    "cacheFrom" => @cache_from,
    "cacheTo" => @cache_to,
    "directory" => @directory,
    "dockerBuildArgs" => @docker_build_args,
    "dockerBuildContexts" => @docker_build_contexts,
    "dockerBuildSecrets" => @docker_build_secrets,
    "dockerBuildSsh" => @docker_build_ssh,
    "dockerBuildTarget" => @docker_build_target,
    "dockerFile" => @docker_file,
    "dockerOutputs" => @docker_outputs,
    "executable" => @executable,
    "networkMode" => @network_mode,
    "platform" => @platform,
  })
  result.compact
end