Class: AWSCDK::BundlingOptions

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
bundling_options.rb

Overview

Bundling options.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(image:, bundling_file_access: nil, command: nil, entrypoint: nil, environment: nil, local: nil, network: nil, output_type: nil, platform: nil, security_opt: nil, user: nil, volumes: nil, volumes_from: nil, working_directory: nil) ⇒ BundlingOptions

Returns a new instance of BundlingOptions.

Parameters:

  • image (AWSCDK::DockerImage)

    The Docker image where the command will run.

  • bundling_file_access (AWSCDK::BundlingFileAccess, nil) (defaults to: nil)

    The access mechanism used to make source files available to the bundling container and to return the bundling output back to the host.

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

    The command to run in the Docker container.

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

    The entrypoint to run in the Docker container.

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

    The environment variables to pass to the Docker container.

  • local (AWSCDK::ILocalBundling, nil) (defaults to: nil)

    Local bundling provider.

  • network (String, nil) (defaults to: nil)
  • output_type (AWSCDK::BundlingOutput, nil) (defaults to: nil)

    The type of output that this bundling operation is producing.

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

    Platform to build for. Requires Docker Buildx.

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

    Security configuration when running the docker container.

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

    The user to use when running the Docker container.

  • volumes (Array<AWSCDK::DockerVolume>, nil) (defaults to: nil)

    Additional Docker volumes to mount.

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

    Where to mount the specified volumes from.

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

    Working directory inside the Docker container.



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 'bundling_options.rb', line 21

def initialize(image:, bundling_file_access: nil, command: nil, entrypoint: nil, environment: nil, local: nil, network: nil, output_type: nil, platform: nil, security_opt: nil, user: nil, volumes: nil, volumes_from: nil, working_directory: nil)
  @image = image
  Jsii::Type.check_type(@image, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5Eb2NrZXJJbWFnZSJ9")), "image")
  @bundling_file_access = bundling_file_access
  Jsii::Type.check_type(@bundling_file_access, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5CdW5kbGluZ0ZpbGVBY2Nlc3MifQ==")), "bundlingFileAccess") unless @bundling_file_access.nil?
  @command = command
  Jsii::Type.check_type(@command, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "command") unless @command.nil?
  @entrypoint = entrypoint
  Jsii::Type.check_type(@entrypoint, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "entrypoint") unless @entrypoint.nil?
  @environment = environment
  Jsii::Type.check_type(@environment, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "environment") unless @environment.nil?
  @local = local
  Jsii::Type.check_type(@local, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5JTG9jYWxCdW5kbGluZyJ9")), "local") unless @local.nil?
  @network = network
  Jsii::Type.check_type(@network, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "network") unless @network.nil?
  @output_type = output_type
  Jsii::Type.check_type(@output_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5CdW5kbGluZ091dHB1dCJ9")), "outputType") unless @output_type.nil?
  @platform = platform
  Jsii::Type.check_type(@platform, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "platform") unless @platform.nil?
  @security_opt = security_opt
  Jsii::Type.check_type(@security_opt, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "securityOpt") unless @security_opt.nil?
  @user = user
  Jsii::Type.check_type(@user, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "user") unless @user.nil?
  @volumes = volumes.is_a?(Array) ? volumes.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::DockerVolume.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : volumes
  Jsii::Type.check_type(@volumes, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLkRvY2tlclZvbHVtZSJ9LCJraW5kIjoiYXJyYXkifX0=")), "volumes") unless @volumes.nil?
  @volumes_from = volumes_from
  Jsii::Type.check_type(@volumes_from, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "volumesFrom") unless @volumes_from.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

#bundling_file_accessAWSCDK::BundlingFileAccess? (readonly)

Note:

Default: - BundlingFileAccess.BIND_MOUNT

The access mechanism used to make source files available to the bundling container and to return the bundling output back to the host.

Returns:



60
61
62
# File 'bundling_options.rb', line 60

def bundling_file_access
  @bundling_file_access
end

#commandArray<String>? (readonly)

Note:

Default: - run the command defined in the image

The command to run in the Docker container.

Example value: ['npm', 'install']

Returns:

  • (Array<String>, nil)

See Also:



68
69
70
# File 'bundling_options.rb', line 68

def command
  @command
end

#entrypointArray<String>? (readonly)

Note:

Default: - run the entrypoint defined in the image

The entrypoint to run in the Docker container.

Example value: ['/bin/sh', '-c']

Returns:

  • (Array<String>, nil)

See Also:



76
77
78
# File 'bundling_options.rb', line 76

def entrypoint
  @entrypoint
end

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

Note:

Default: - no environment variables.

The environment variables to pass to the Docker container.

Returns:

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


81
82
83
# File 'bundling_options.rb', line 81

def environment
  @environment
end

#imageAWSCDK::DockerImage (readonly)

The Docker image where the command will run.

Returns:



55
56
57
# File 'bundling_options.rb', line 55

def image
  @image
end

#localAWSCDK::ILocalBundling? (readonly)

Note:

Default: - bundling will only be performed in a Docker container

Local bundling provider.

The provider implements a method try_bundle() which should return true if local bundling was performed. If false is returned, docker bundling will be done.

Returns:



90
91
92
# File 'bundling_options.rb', line 90

def local
  @local
end

#networkString? (readonly)

Note:

Default: - no networking options

Docker Networking options.

Returns:

  • (String, nil)


95
96
97
# File 'bundling_options.rb', line 95

def network
  @network
end

#output_typeAWSCDK::BundlingOutput? (readonly)

Note:

Default: BundlingOutput.AUTO_DISCOVER

The type of output that this bundling operation is producing.

Returns:



100
101
102
# File 'bundling_options.rb', line 100

def output_type
  @output_type
end

#platformString? (readonly)

Note:

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.

Returns:

  • (String, nil)


107
108
109
# File 'bundling_options.rb', line 107

def platform
  @platform
end

#security_optString? (readonly)

Note:

Default: - no security options

Security configuration when running the docker container.

Returns:

  • (String, nil)


112
113
114
# File 'bundling_options.rb', line 112

def security_opt
  @security_opt
end

#userString? (readonly)

Note:

Default: - uid:gid of the current user or 1000:1000 on Windows

The user to use when running the Docker container.

user | user:group | uid | uid:gid | user:gid | uid:group

Returns:

  • (String, nil)

See Also:



120
121
122
# File 'bundling_options.rb', line 120

def user
  @user
end

#volumesArray<AWSCDK::DockerVolume>? (readonly)

Note:

Default: - no additional volumes are mounted

Additional Docker volumes to mount.

Returns:



125
126
127
# File 'bundling_options.rb', line 125

def volumes
  @volumes
end

#volumes_fromArray<String>? (readonly)

Note:

Default: - no containers are specified to mount volumes from

Where to mount the specified volumes from.



131
132
133
# File 'bundling_options.rb', line 131

def volumes_from
  @volumes_from
end

#working_directoryString? (readonly)

Note:

Default: /asset-input

Working directory inside the Docker container.

Returns:

  • (String, nil)


136
137
138
# File 'bundling_options.rb', line 136

def working_directory
  @working_directory
end

Class Method Details

.jsii_propertiesObject



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'bundling_options.rb', line 138

def self.jsii_properties
  {
    :image => "image",
    :bundling_file_access => "bundlingFileAccess",
    :command => "command",
    :entrypoint => "entrypoint",
    :environment => "environment",
    :local => "local",
    :network => "network",
    :output_type => "outputType",
    :platform => "platform",
    :security_opt => "securityOpt",
    :user => "user",
    :volumes => "volumes",
    :volumes_from => "volumesFrom",
    :working_directory => "workingDirectory",
  }
end

Instance Method Details

#to_jsiiObject



157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'bundling_options.rb', line 157

def to_jsii
  result = {}
  result.merge!({
    "image" => @image,
    "bundlingFileAccess" => @bundling_file_access,
    "command" => @command,
    "entrypoint" => @entrypoint,
    "environment" => @environment,
    "local" => @local,
    "network" => @network,
    "outputType" => @output_type,
    "platform" => @platform,
    "securityOpt" => @security_opt,
    "user" => @user,
    "volumes" => @volumes,
    "volumesFrom" => @volumes_from,
    "workingDirectory" => @working_directory,
  })
  result.compact
end