Class: Escualo::Script::Dockerized

Inherits:
Mode
  • Object
show all
Defined in:
lib/escualo/script.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Mode

#run_commands_for!

Instance Attribute Details

#dockerfileObject

Returns the value of attribute dockerfile.



39
40
41
# File 'lib/escualo/script.rb', line 39

def dockerfile
  @dockerfile
end

Instance Method Details

#base_image(options) ⇒ Object



50
51
52
53
54
55
56
57
58
# File 'lib/escualo/script.rb', line 50

def base_image(options)
  if options.base_image == 'ubuntu'
    'ubuntu:xenial'
  elsif options.base_image == 'debian'
    'debian:jessie'
  else
    raise "Unsupported base image #{options.base_image}. Only debian and ubuntu are supported"
  end
end

#finish!Object



64
65
66
# File 'lib/escualo/script.rb', line 64

def finish!
  File.write('Dockerfile', @dockerfile)
end

#run_command!(command, ssh, options) ⇒ Object



60
61
62
# File 'lib/escualo/script.rb', line 60

def run_command!(command, ssh, options)
  @dockerfile << "RUN #{command}\n"
end

#start!(options) ⇒ Object



41
42
43
44
45
46
47
48
# File 'lib/escualo/script.rb', line 41

def start!(options)
  @dockerfile = "
FROM #{base_image options}
MAINTAINER #{ENV['USER']}
RUN apt-get update && apt-get install ruby ruby-dev build-essential -y
RUN gem install escualo -v #{Escualo::VERSION}
"
end