class DockerComposeDeploy::Actions::Image

Public Instance Methods

push() click to toggle source
# File lib/docker_compose_deploy/actions/image.rb, line 8
def push
  shell.notify "Pushing #{name} to remote"

  shell.run!("docker save #{name} > #{tmp_file_path}")
  shell.run!("bzip2 #{tmp_file_path}")
  shell.scp!("#{tmp_file_path}.bz2", "#{connection}:/tmp/")
  shell.run!("rm #{tmp_file_path}.bz2")
  shell.ssh!("docker load -i /tmp/#{filename}.bz2")

  shell.notify "success"
end

Private Instance Methods

connection() click to toggle source
# File lib/docker_compose_deploy/actions/image.rb, line 36
def connection
  DockerComposeDeploy.config.connection
end
filename() click to toggle source
# File lib/docker_compose_deploy/actions/image.rb, line 28
def filename
  @filename ||= "#{name.gsub('/', '__')}_#{SecureRandom.hex}.tar"
end
tmp_dir() click to toggle source
# File lib/docker_compose_deploy/actions/image.rb, line 22
def tmp_dir
  @tmp_dir ||= "./tmp".tap do |dir|
    FileUtils.mkdir_p(dir)
  end
end
tmp_file_path() click to toggle source
# File lib/docker_compose_deploy/actions/image.rb, line 32
def tmp_file_path
  File.join(tmp_dir, filename)
end