Class: CIDE::Builder
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #build(tag: nil, pull: nil, ssh_key: nil) ⇒ Object
-
#initialize(config) ⇒ Builder
constructor
A new instance of Builder.
Methods included from Docker
Constructor Details
#initialize(config) ⇒ Builder
Returns a new instance of Builder.
11 12 13 14 |
# File 'lib/cide/builder.rb', line 11 def initialize(config) @config = config @tmp_files = [] end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
9 10 11 |
# File 'lib/cide/builder.rb', line 9 def config @config end |
Instance Method Details
#build(tag: nil, pull: nil, ssh_key: nil) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/cide/builder.rb', line 16 def build(tag: nil, pull: nil, ssh_key: nil) fail ArgumentError, 'tag missing' unless tag if config.use_ssh fail ArgumentError, 'ssh_key missing' unless ssh_key unless File.exist?(ssh_key) fail ArgumentError, "ssh_key #{ssh_key} not found" end create_tmp_file! TEMP_SSH_KEY, File.read(ssh_key) end create_tmp_file! DOCKERFILE, config.to_dockerfile = ['--force-rm'] << '--pull' if pull .push '-f', DOCKERFILE .push '-t', tag << '.' docker :build, * ensure release_tmp_files! end |