class Dockerploy::Image

Public Class Methods

new(config, options = {}) click to toggle source
# File lib/dockerploy/image.rb, line 3
def initialize(config, options = {})
  @config = config
  @options = options
end

Public Instance Methods

build() click to toggle source
# File lib/dockerploy/image.rb, line 8
def build
  command = sprintf('env DOCKER_HOST=%s docker build -t %s .', @config.docker_host, image_name)
  ShellClient.new.command(command)
end
pull() click to toggle source
# File lib/dockerploy/image.rb, line 18
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', image_name))
  end
end
push() click to toggle source
# File lib/dockerploy/image.rb, line 13
def push
  command = sprintf('env DOCKER_HOST=%s docker push %s', @config.docker_host, image_name)
  ShellClient.new.command(command)
end

Private Instance Methods

image_name() click to toggle source
# File lib/dockerploy/image.rb, line 27
def image_name
  @options[:tag] ? sprintf('%s:%s', @config.image_name, @options[:tag]) : @config.image_name
end