Class: AWSCDK::DockerImage
- Inherits:
-
Jsii::Object
- Object
- Jsii::Object
- AWSCDK::DockerImage
- Defined in:
- docker_image.rb
Overview
A Docker image.
Class Method Summary collapse
-
.from_build(path, options = nil) ⇒ AWSCDK::DockerImage
Builds a Docker image.
-
.from_registry(image) ⇒ AWSCDK::DockerImage
Reference an image on DockerHub or another online registry.
- .jsii_overridable_methods ⇒ Object
Instance Method Summary collapse
-
#cp(image_path, output_path = nil) ⇒ String
Copies a file or directory out of the Docker image to the local filesystem.
-
#image ⇒ String
The Docker image.
-
#initialize(image, _image_hash = nil) ⇒ DockerImage
constructor
A new instance of DockerImage.
-
#run(options = nil) ⇒ void
Runs a Docker image.
-
#to_json ⇒ String
Provides a stable representation of this image for JSON serialization.
Constructor Details
#initialize(image, _image_hash = nil) ⇒ DockerImage
Returns a new instance of DockerImage.
10 11 12 13 14 |
# File 'docker_image.rb', line 10 def initialize(image, _image_hash = nil) Jsii::Type.check_type(image, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "image") Jsii::Type.check_type(_image_hash, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "_imageHash") unless _image_hash.nil? Jsii::Object.instance_method(:initialize).bind(self).call(image, _image_hash) end |
Class Method Details
.from_build(path, options = nil) ⇒ AWSCDK::DockerImage
Builds a Docker image.
30 31 32 33 34 35 |
# File 'docker_image.rb', line 30 def self.from_build(path, = nil) Jsii::Type.check_type(path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "path") = .is_a?(Hash) ? ::AWSCDK::DockerBuildOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5Eb2NrZXJCdWlsZE9wdGlvbnMifQ==")), "options") unless .nil? Jsii::Kernel.instance.call_static("aws-cdk-lib.DockerImage", "fromBuild", [path, ]) end |
.from_registry(image) ⇒ AWSCDK::DockerImage
Reference an image on DockerHub or another online registry.
41 42 43 44 |
# File 'docker_image.rb', line 41 def self.from_registry(image) Jsii::Type.check_type(image, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "image") Jsii::Kernel.instance.call_static("aws-cdk-lib.DockerImage", "fromRegistry", [image]) end |
.jsii_overridable_methods ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'docker_image.rb', line 16 def self.jsii_overridable_methods { :image => { kind: :property, name: "image", is_optional: false }, :cp => { kind: :method, name: "cp", is_optional: false }, :run => { kind: :method, name: "run", is_optional: false }, :to_json => { kind: :method, name: "toJSON", is_optional: false }, } end |
Instance Method Details
#cp(image_path, output_path = nil) ⇒ String
Copies a file or directory out of the Docker image to the local filesystem.
If output_path is omitted the destination path is a temporary directory.
60 61 62 63 64 |
# File 'docker_image.rb', line 60 def cp(image_path, output_path = nil) Jsii::Type.check_type(image_path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "imagePath") Jsii::Type.check_type(output_path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "outputPath") unless output_path.nil? jsii_call_method("cp", [image_path, output_path]) end |
#image ⇒ String
The Docker image.
49 50 51 |
# File 'docker_image.rb', line 49 def image() jsii_get_property("image") end |
#run(options = nil) ⇒ void
This method returns an undefined value.
Runs a Docker image.
70 71 72 73 74 |
# File 'docker_image.rb', line 70 def run( = nil) = .is_a?(Hash) ? ::AWSCDK::DockerRunOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5Eb2NrZXJSdW5PcHRpb25zIn0=")), "options") unless .nil? jsii_call_method("run", []) end |
#to_json ⇒ String
Provides a stable representation of this image for JSON serialization.
79 80 81 |
# File 'docker_image.rb', line 79 def to_json() jsii_call_method("toJSON", []) end |