Class: Holodekk::Image::Instructions::Run
- Inherits:
-
Builder::Instruction
show all
- Defined in:
- lib/holodekk/image/instructions/run.rb,
lib/holodekk/image/instructions/run/options/with_ssh_mount.rb,
lib/holodekk/image/instructions/run/options/with_bind_mount.rb,
lib/holodekk/image/instructions/run/options/with_cache_mount.rb,
lib/holodekk/image/instructions/run/options/with_tmpfs_mount.rb,
lib/holodekk/image/instructions/run/options/with_secret_mount.rb
Defined Under Namespace
Modules: Instructions, Options
Classes: Builder
Class Method Summary
collapse
Instance Method Summary
collapse
#as_json, instruction_tag, tag, #tag, #to_json
Class Method Details
.build(cmd = nil, &block) ⇒ Object
7
8
9
10
11
12
13
|
# File 'lib/holodekk/image/instructions/run.rb', line 7
def self.build(cmd = nil, &block)
run = new
builder = Builder.new(run.instructions, run.options)
builder.run(cmd) unless cmd.nil?
builder.instance_eval(&block) if block_given?
run
end
|
Instance Method Details
#instructions ⇒ Object
15
16
17
|
# File 'lib/holodekk/image/instructions/run.rb', line 15
def instructions
@instructions ||= []
end
|
#options ⇒ Object
19
20
21
|
# File 'lib/holodekk/image/instructions/run.rb', line 19
def options
@options ||= []
end
|
#to_dockerfile ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/holodekk/image/instructions/run.rb', line 23
def to_dockerfile
res = 'RUN '.dup
unless options.empty?
res << options.map(&:to_dockerfile).join(',')
res << " \\\n\t"
end
res << instructions.map(&:to_dockerfile).join(" && \\\n\t")
res
end
|