Class: Dockerploy::Image
- Inherits:
-
Object
- Object
- Dockerploy::Image
- Defined in:
- lib/dockerploy/image.rb
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(config) ⇒ Image
constructor
A new instance of Image.
- #pull ⇒ Object
- #push ⇒ Object
Constructor Details
#initialize(config) ⇒ Image
Returns a new instance of Image.
3 4 5 |
# File 'lib/dockerploy/image.rb', line 3 def initialize(config) @config = config end |
Instance Method Details
#build ⇒ Object
7 8 9 10 |
# File 'lib/dockerploy/image.rb', line 7 def build command = sprintf('env DOCKER_HOST=%s docker build -t %s .', @config.docker_host, @config.image_name) ShellClient.new.command(command) end |
#pull ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/dockerploy/image.rb', line 17 def pull return unless @config.servers @config.servers.each do |server| ssh_client = SSHClient.new(server[:host], server[:username], server[:password], server[:port]) ssh_client.command(sprintf('docker pull %s', @config.image_name)) end end |
#push ⇒ Object
12 13 14 15 |
# File 'lib/dockerploy/image.rb', line 12 def push command = sprintf('env DOCKER_HOST=%s docker push %s', @config.docker_host, @config.image_name) ShellClient.new.command(command) end |